Home > database >  We have compound trigger this BUG
We have compound trigger this BUG

Time:10-09

In BEFORE EACH ROW, the UPDATE statement SET field corresponding: the new value is empty,
AFTER EACH ROW you can take to: the value of the new

Such as:
The CREATE OR REPLACE the TRIGGER tr_table1_ct
FOR the INSERT OR UPDATE OR DELETE ON table1
COMPOUND TRIGGER
BEFORE the STATEMENT IS the BEGIN END BEFORE the STATEMENT; */
BEFORE EACH ROW IS the BEGIN
Dbms_output. Put_line (' BEFORE EACH ROW '
| | '/col1:' | | : old. Col1
| | '/col1:' | | : new, col1
);
END BEFORE EACH ROW;
AFTER EACH ROW IS the BEGIN
Dbms_output. Put_line (' AFTER EACH ROW '
| | '/col1:' | | : old. Col1
| | '/col1:' | | : new, col1
);
END AFTER EACH ROW;
END tr_table1_ct;

The UPDATE table1
The SET col1='test'
WHEREid=123
; BEFORE this time - EACH ROW: new. Col1 is empty

- if the UPDATE does not use col1
The UPDATE table1
The SET col2='222'
WHEREid=123
; BEFORE this time - EACH ROW: new.
col1 is not empty

CodePudding user response:

1, the table whether there is any other triggers,

2, the first step, you determine if the execution is the update? If the insert will have this phenomenon,

CodePudding user response:

There is no other triggers,
Update the field changes the result is: the new value is empty,
The insert is normal
  • Related