CREATE OR REPLACE TRIGGER "SKY_FINANCEACCREDITPAY_INSERT" BEFORE INSERT ON "COMPANY"."SKY_FINANCEACCREDITPAY" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROWdeclare? -- local variables here?serialno ? ? ?integer ;?strTableCode ?VARCHAR2(20);?strAutoCode ? varchar2(20);?strTableName ?VARCHAR2(100);begin? strTableName := 'SKY_FINANCEACCREDITPAY';? if :new.nbtype is not null then? ? ? --取得表的類型編號? ? ? SELECT TableCode INTO strTableCode FROM SKY_TableInfo WHERE TableName=strTableName;? ? ? if strTableCode is not null then? ? ? ? ? --取得當(dāng)天最大流水號? ? ? ? ? select nvl((max(to_number(substr(AutoCode,12,4)))),0) into serialno?? ? ? ? ? from ?SKY_FINANCEACCREDITPAY where substr(AutoCode,4,8)=to_char(sysdate,'yyyymmdd');? ? ? ? ??? ? ? ? ? --流水號加1? ? ? ? ? serialno:= serialno + 1;? ? ? ? ??? ? ? ? ? --為插入的記錄AutoCode賦值? ? ? ? ? strAutoCode:=:new.nbtype|| strTableCode ||to_char(sysdate,'yyyymmdd')||LPad(to_char(serialno),4,'0');? ? ? ? ??? ? ? ? ? :new.AutoCode:=strAutoCode;? ? ? ? ??? ? ? ? ? INSERT INTO SKY_AutoCodeInfo(TableName,Autocode) VALUES(strTableName,strAutoCode);? ? ? end if;? end if;??end SKY_FINANCEACCREDITPAY_insert;就是這個(gè)觸發(fā)器有時(shí)候條件滿足也沒有執(zhí)行,這是什么問題
- 1 回答
- 0 關(guān)注
- 1507 瀏覽
添加回答
舉報(bào)
0/150
提交
取消