插入或更新触发器后的Oracle 12c

时间:2019-03-06 12:06:24

标签: sql oracle plsql oracle11g database-trigger

我有一个以下触发器,该触发器会更新,但会自动回滚,我找不到原因,请帮忙。

仅供参考:更新表UDF_DATA具有对CCEX.CUSTOMER触发表的外键引用。

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;
/

1 个答案:

答案 0 :(得分:0)

由于触发器处于Option Explicit Private Sub Workbook_Open() Dim DesiredFilePath As String, CurrentFilePath As String, wb As Workbook Set wb = ThisWorkbook DesiredFilePath = "C:\" & wb.Name CurrentFilePath = wb.Path & "\" & wb.Name If DesiredFilePath <> CurrentFilePath Then wb.SaveAs DesiredFilePath On Error Resume Next Kill CurrentFilePath On Error GoTo 0 MsgBox "The file wasn't saved where it should be to work properly. It's been saved in: " & CurrentFilePath End If End Sub 模式,因此应关闭事务。

请在例外行之前添加autonomous_transaction