CREATE OR REPLACE TRIGGER "SKY_FINANCEACCREDITPAY_INSERT" BEFORE INSERT ON "COMPANY"."SKY_FINANCEACCREDITPAY" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW
declare
-- 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
--取得当天最大流水号
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;
就是这个触发器有时候条件满足也没有执行,这是什么问题
_沉醉不知归路_
相关分类