Output new and old value in a before update trigger
SQL>
SQL> create table t ( x int, y int );
Table created.
SQL>
SQL> insert into t values ( 1, 1 );
1 row created.
SQL>
SQL> create or replace trigger t_bufer
2 before update on t for each row
3 begin
4 dbms_output.put_line( 'old.x = ' || :old.x ||', old.y = ' || :old.y );
5 dbms_output.put_line( 'new.x = ' || :new.x ||', new.y = ' || :new.y );
6 end;
7 /
Trigger created.
SQL> set serveroutput on
SQL> update t set x = x+1;
old.x = 1, old.y = 1
new.x = 2, new.y = 1
1 row updated.
SQL>
SQL> drop table t;
Table dropped.
SQL>
Related examples in the same category