我希望我的触发器的特定部分在java应用程序执行更新的情况下逐个执行,这会导致触发器的调用。
create or replace TRIGGER TA_TB_BATCHFILE_UPD
BEFORE UPDATE OF EOM_ORDER_RESULT ON TB_SERVICEORDER
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
PROCESSED_ORDERS_COUNT NUMBER(6) :=0;
BEGIN
IF :NEW.BATCH_FILE_ID IS NOT NULL AND (NVL(:OLD.EOM_ORDER_RESULT,'X') != NVL(:NEW.EOM_ORDER_RESULT,'X'))
THEN
SELECT PROCESSED_ORDERS INTO PROCESSED_ORDERS_COUNT FROM TB_BATCHFILE WHERE BATCH_FILE_ID = :NEW.BATCH_FILE_ID FOR UPDATE of PROCESSED_ORDERS;
IF PROCESSED_ORDERS_COUNT is NULL
then
PROCESSED_ORDERS_COUNT:=1;
ELSE
PROCESSED_ORDERS_COUNT := PROCESSED_ORDERS_COUNT+1;
END IF;
UPDATE TB_BATCHFILE E SET E.PROCESSED_ORDERS = PROCESSED_ORDERS_COUNT ,E.PROCESSED_TIMESTAMP = SYSTIMESTAMP WHERE E.BATCH_FILE_ID=:NEW.BATCH_FILE_ID ;
END IF;
END TA_TB_BATCHFILE_UPD;
我想让下面的代码逐一执行。
SELECT PROCESSED_ORDERS INTO PROCESSED_ORDERS_COUNT FROM TB_BATCHFILE WHERE BATCH_FILE_ID = :NEW.BATCH_FILE_ID ;
IF PROCESSED_ORDERS_COUNT is NULL
then
PROCESSED_ORDERS_COUNT:=1;
ELSE
PROCESSED_ORDERS_COUNT := PROCESSED_ORDERS_COUNT+1;
END IF;
UPDATE TB_BATCHFILE E SET E.PROCESSED_ORDERS = PROCESSED_ORDERS_COUNT ,E.PROCESSED_TIMESTAMP = SYSTIMESTAMP WHERE E.BATCH_FILE_ID=:NEW.BATCH_FILE_ID ;