Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Which column is being updated
Try the following example:
SQL> create table testtab (n number, a varchar2 (50), d date);
Table created.
SQL>
SQL> create or replace trigger testtrigg
2 after update
3 of n, a
4 on testtab
5 begin
6 if updating ('N') then 7 dbms_output.put_line ('updating N...'); 8 end if; 9 if updating ('A') then 10 dbms_output.put_line ('updating A...'); 11 end if;
Trigger created.
SQL> SQL> set serveroutput on size 1000000 SQL> SQL> insert into testtab (n, a, d) values (5, 'abc', sysdate);
1 row created.
SQL>
SQL> update testtab set n = 6;
updating N...
1 row updated.
SQL> update testtab set a = 'bbb';
updating A...
1 row updated.
SQL> update testtab set n = 8, a = 'def';
updating N... updating A...
1 row updated.
SQL> update testtab set d = sysdate - 1;
1 row updated.
SQL>
SQL> commit;
Commit complete.
Martin
Simon Irvin wrote:
>
> Is there any way I can make use of whatever information Oracle uses to
> decide whether or not to fire a trigger that is only invoked on updates to a
> subset of the columns in a table. (Hope that makes sense!) What I suppose I
> mean is when you define a trigger to be fired on "UPDATE OF column1" how
> does Oracle know it is column1 that has been updated and can I obtain the
> same information?
>
> Cheers
>
> Simon Irvin
Received on Wed Apr 18 2001 - 16:24:53 CDT
![]() |
![]() |