t_c_b_s之儲存過程寫法小記

wisdomone1發表於2011-07-20
採用plsql特殊型別及引數遊標來運算元據如下:lvnLoopCtr := 1;

 OPEN curs_GetFundInfo(lvnAcctNbr, lvnRTXNNbr);--引數遊標

 LOOP

  FETCH curs_GetFundInfo
  INTO lvsFundTypCd,
    lvsFundTypDtlCd,
    lvsClearCatCd,
    lvnSeqNbr,
    lvnNbrOfItems,
    lvnAmt;
  EXIT WHEN curs_GetFundInfo%NOTFOUND;

  lvasFundTypCd(lvnLoopCtr) := lvsFundTypCd; --plsql記錄型別
  lvasFundTypDtlCd(lvnLoopCtr) := lvsFundTypDtlCd;
  lvasClearCatCd(lvnLoopCtr) := lvsClearCatCd;
  lvanSeqNbr(lvnLoopCtr) := lvnSeqNbr;
  lvanNbrOfItems(lvnLoopCtr) := lvnNbrOfItems;
  lvanFundsAmt(lvnLoopCtr) := lvnAmt;

  lvnFundTypArraySize := lvnLoopCtr;

  lvnLoopCtr := lvnLoopCtr + 1;

 END LOOP;

 CLOSE curs_GetFundInfo;rtxnrptgrprtxntyp表為何義?receipt收據;檢視儲存過程PROC_ED_CALCDEPOSITACCRUEDINT;intraterecalcmeth表是利息利率重新計算方法表;混合利率及複合利率;ratechangemeth利率變化方法表,On Cycle及Calendar Period;利率改變方法;LEAP YEAR;

檢視此儲存過程PACK_NEWDISB;
SELECT A.MjAcctTypCd,
             A.CurrMiAcctTypCd,
             A.DateLastMaint,
             A.CurrAcctStatCd,
             A.NextSubNbr,
             A.CurrAcctStatCd,
             B.AccrThruDueDateYN,
             C.BillAdvanceYN,
             B.PmtCalcIncludeOddDaysYN,
             C.Date1stPmtDue,
             B.OddDaysMethCd,
             --          B.PassbookLoanYN, C.RevolveLoanYN, C.LoanLimitYN
             B.PassbookLoanYN,
             C.RevolveLoanYN,
             C.LoanLimitYN,
             B.RnewAllowedYN,
             A.ContractDate --Modified By RSI on 07-20-2005 for Issue# 0069-346
        INTO lvsMjAcctTypCd,
             lvsMiAcctTypCd,
             lvdtAcctDateLastMaint,
             lvsAcctStatCd,
             lvnNextSubAcctNbr,
             lvsCurrAcctStatCd,
             lvsAccrThruDueDateYN,
             lvsBillAdvanceYN,
             lvsPmtCalcIncludeOddDaysYN,
             lvdFirstDueDate,
             lvsOddDaysMethCd,
             --        lvsPassBookLoanYN, lvsRevolveLoanYN, lvsLoanLimitYN
             lvsPassBookLoanYN,
             lvsRevolveLoanYN,
             lvsLoanLimitYN,
             lvsRnewAllowedYN,
             lvdContractDate --Modified By RSI on 07-20-2005 for Issue# 0069-346
        FROM Acct A, MjMiAcctTyp B, AcctLoan C
       WHERE A.AcctNbr = in_ACCTNBR
         AND B.MjAcctTypCd = A.MjAcctTypCd
         AND B.MiAcctTypCd = A.CurrMiAcctTypCd
         AND C.AcctNbr = A.AcctNbr
         FOR UPDATE;--排它賦值 select into for update



此種寫法;lvbIntExists := (lvnExistsCount > 0);--變數的賦值為一個表示式,此表示式的結果為布林值false or true




來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-702678/,如需轉載,請註明出處,否則將追究法律責任。

相關文章