oracle 触发器 删除表中的内容插入到另一张表

CREATE OR REPLACE TRIGGER AR_DETAIL_DELETE
       BEFORE DELETE ON AR_DETAIL
       REFERENCING NEW AS NEW OLD AS OLD
       FOR EACH ROW
       
       DECLARE
              PRAGMA AUTONOMOUS_TRANSACTION;       (1)
              CURSOR CUS_HR IS
                     SELECT EMPID FROM AR_DETAIL WHERE PK_NO = :OLD.PK_NO;
                    
       BEGIN
            FOR HR_ROW IN CUS_HR 
            LOOP
                INSERT INTO TABLEA VALUES(HR_ROW.EMPID);
            END LOOP;
            
       COMMIT;                                      (2)
       
END AR_DETAIL_DELETE;


没写(1),(2)之前报下图错

你可能感兴趣的:(oracle,idea)