PROCEDURE proc_FINDNEXTQUEUE ( in_QUETYPCATCD IN QueTypCat.QUETYPCATCD%TYPE,
in_NTWKNODENBR IN Que.AssignedNtwkNodeNbr%TYPE,
in_POSTDATE IN DATE,
in_DEBUGYN IN CHAR,
out_QueNbr OUT Que.QueNbr%TYPE,
out_ERRORNBR OUT NUMBER,
out_ERRORMSG OUT VARCHAR2,
out_ORAERRORMSG OUT VARCHAR2 )
/************************************************************************************************/
/***** *****/
/***** PROCEUDRE NAME: pack_BATCHAUTO.proc_FINDNEXTQUEUE *****/
/***** *****/
/***** DESCRIPTION: This procedure will find the next queue to be assigned *****/
/***** and return the number to the calling procedure. *****/
/***** *****/
/***** *****/
/***** MODIFICATION HISTORY: *****/
/***** *****/
/***** 2/6/2006 - MSG - Rewritten to only find the next queue, not copy them all *****/
/***** *****/
/***** 12/12/2005, Modified by Sachin at RSI for new Month Code Parameter *****/
/***** while calculating schedule date and copying templates with *****/
/***** RequiredNtwkNodeNbr as NULL *****/
/***** *****/
/************************************************************************************************/
AS
/***************************************************************************************/
/***** CURSOR VARIABLE *****/
/***************************************************************************************/
CURSOR curs_QUETEMPLATE ( cpsQueTypCatCd QueTypCat.QueTypCatCd%TYPE ) IS
SELECT A.QueNbr, A.EffDateCalc, B.CalPeriodCd, B.DayNbr, B.WeekDayCd, B.MonthCd,
A.Priority, A.SeqNbr, A.RequiredNtwkNodeNbr
FROM Que A, QueTyp B, QueTypCat C
WHERE A.QueTypCd = B.QueTypCd
AND B.QueTypCatCd = C.QueTypCatCd
AND C.QueTypCatCd = cpsQueTypCatCd
AND A.TemplateYN = 'Y'
AND (( A.RequiredNtwkNodeNbr = in_NTWKNODENBR) OR ( A.RequiredNtwkNodeNbr IS NULL) ) -- Modified by Sachin at RSI on 12/12/2005
AND (( A.DateLastCopied < in_POSTDATE) OR (A.DateLastCopied IS NULL ) )
ORDER BY A.Priority , A.SeqNbr ;
/************************************************************************************/
/***** OSI ERROR PROCESSING VARIABLES *****/
/************************************************************************************/
OSI_GENERAL_ERROR EXCEPTION;
lvnErrorNbr INTEGER;
lvnUserPersNbr INTEGER;
lvsActvMsg VARCHAR2(100);
lvsSubProcErrorMsg VARCHAR2(100);
lvsORACLEMsg VARCHAR2(100);
/************************************************************************************/
/***** GENERAL PROCEDURE VARIABLES *****/
/************************************************************************************/
OSI_FOUND_A_QUEUE EXCEPTION;
lvnQueNbr Que.QueNbr%TYPE;
lvnPriority Que.Priority%TYPE;
lvnLastPriority Que.Priority%TYPE;
lvnSeqNbr Que.SeqNbr%TYPE;
lvsEffDateCalc Que.EffDateCalc%TYPE;
lvdPostDate DATE;
lvsCalPeriodCd QueTyp.CalPeriodCd%TYPE;
lvsWeekDayCd QueTyp.WeekDayCd%TYPE;
lvnDayNbr QueTyp.DayNbr%TYPE;
lvsMonthCd QueTyp.MonthCd%TYPE;
lvnRequiredNtwkNodeNbr Que.AssignedNtwkNodeNbr%TYPE;
lvsCopy CHAR(1);
/************************************************************************************/
/***** PROCEDURE CONSTANTS *****/
/************************************************************************************/
lcsDebugProcCd CONSTANT VARCHAR2(4) := 'CAQU';
BEGIN
lvdPostDate := TO_DATE(TO_CHAR(in_POSTDATE, 'MM-DD-YYYY'), 'MM-DD-YYYY');
lvnLastPriority := -1;
lvsActvMsg := 'Opening the cursor curs_QUETEMPLATE';
OPEN curs_QUETEMPLATE ( in_QUETYPCATCD ) ;
LOOP
lvsActvMsg := 'Fetch curs_QUETEMPLATE for quetypcatcd';
FETCH curs_QUETEMPLATE
INTO lvnQueNbr ,
lvsEffDateCalc ,
lvsCalPeriodCd ,
lvnDayNbr ,
lvsWeekDayCd,
lvsMonthCd,
lvnPriority,
lvnSeqNbr,
lvnRequiredNtwkNodeNbr;
EXIT WHEN curs_QUETEMPLATE%NOTFOUND;
lvsActvMsg := 'Executing proc_SCHEDATE';
proc_SCHEDATE (lvsCalPeriodCd, lvnDayNbr, lvsWeekDayCd, lvsMonthCd, lvdPostDate, in_DEBUGYN, -- Modified by Sachin at RSI on 12/12/2005
lvsCopy, lvnErrorNbr, lvsSubProcErrorMsg, lvsORACLEMsg );
IF ( lvnErrorNbr > 0 ) THEN
lvsActvMsg := lvsSubProcErrorMsg;
RAISE OSI_GENERAL_ERROR;
END IF;
IF lvsCopy = 'Y' THEN
RAISE OSI_FOUND_A_QUEUE;
End If;
END LOOP;
out_QueNbr := 0;
EXCEPTION
WHEN OSI_FOUND_A_QUEUE THEN
out_QueNbr := lvnQueNbr;
out_ERRORNBR := 0;
WHEN OSI_GENERAL_ERROR THEN
IF ( lvnErrorNbr > 0 ) THEN
out_ERRORNBR := lvnErrorNbr;
ELSE
out_ERRORNBR := 1001;
END IF;
out_ORAERRORMSG := lvsORACLEMsg;
out_ERRORMSG := lvsActvMsg||'-'||lcsDebugProcCd;
WHEN OTHERS THEN
lvsORACLEMsg := SUBSTR(SQLERRM, 1, 100);
out_ORAERRORMSG := lvsORACLEMsg;
out_ERRORNBR := ABS(SQLCODE);
out_ERRORMSG := lvsActvMsg;
END proc_FINDNEXTQUEUE;
小结:存储过程的输出参数可以在异常中输出,当然一般不发生异常则正常输出
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-734772/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-734772/