简体   繁体   中英

Oracle 12c AFTER INSERT OR UPDATE TRIGGER

I Have a following trigger, which updates but and rolling back automatically, I'm not finding what is the cause, kindly help.

FYI: updating table UDF_DATA has a foreign key reference to CCEX.CUSTOMER triggering table.

CREATE OR REPLACE TRIGGER TR_CUSTOMER_PM
AFTER INSERT OR UPDATE ON CCEX.CUSTOMER FOR EACH ROW
DECLARE
  i_subscriber_id     Number :=3080;
  user_xcep EXCEPTION;
  PRAGMA EXCEPTION_INIT( user_xcep, -20001 );
  pragma autonomous_transaction;
  i_syscode ccex.customer.cust_system_code%type;
BEGIN
  IF  :new.cust_account_number like 'TID%' THEN

    i_syscode:=  :new.cust_system_code;
    update udf_data set value = 'Term'
    where subscriber_id = i_subscriber_id
    and cust_system_code = i_syscode
    and entity_id = '1488_OTA'
    and udf_id = '3994_OTA'
    and name = 'Primary Manager';
  END IF;
EXCEPTION
  when others then
    raise user_xcep;
END;
/

Since the trigger is in autonomous_transaction mode, it should close the transaction.

Please add commit just before the exception line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM