|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Oracle - Trigger for delete, insert, update
Hi everyone,
I made the following trigger: create or replace trigger deptneu_2_ins_upd_del after update on deptneu_2 begin if inserting then dbms_output.put_line ('insert!'); end if; if updating then dbms_output.put_line ('upgedate!'); end if; if deleting then dbms_output.put_line ('delete!'); end if; end; / but only if I update the table the trigger is working. What could be wrong? Another question: if I change the attribute "location" the trigger should tell the old value as well as the new one? Could anyone tell me how to do that? Thank you very much in advance! Peter |
|
#2
|
|||
|
|||
|
You need to change
after update on deptneu_2 to after update,insert,delete on deptneu_2 Quote:
use :new and :old variables to reference the two records. E.g. IF :new.location <> :old.location THEN -- loction has changed END; |
|
#3
|
|||
|
|||
|
Thank you very much, shammat!
Peter |
|
#4
|
|||
|
|||
|
Just for the record: this is something that can easily be looked up in the manual
|
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Oracle - Trigger for delete, insert, update |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|