Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> AFTER UPDATE trigger not working trying to specify WHEN
I don't know triggers, but this seems like it should be simple. Want
to update a history table with changes to particular field of other
table. Field is updated by third party software, and seems to update
table three times every time. I only want the actual change recorded.
Are there any suggestions on why this doesn't work?
When price_status = 'M','L' or 'F' and is switched to another of these, the trigger will record history. When price_status = ' ' (instead of null) and is changed to 'M','L' of 'F' or from one of these to ' ', no history is recorded.
When I remove the when statement, price_status changes are recorded with new and old values, but also recorded twice more with values exactly the same. This generates an enormous amount of data.
DECLARE
l_action CHAR(1);
BEGIN
l_action := 'U';
INSERT INTO t_history
(ap_num, action, datestamp, oracle_user, old_lock_type, old_price_status, old_lockin_date, old_lockin_expires, new_lock_type, new_price_status, new_lockin_date, new_lockin_expires)
I also have tried:
IF :old.price_status != :new.price_status
THEN
INSERT .....
This also fails.
Any suggestions are appreciated.
Thank You.
Joe
Received on Thu Nov 06 2003 - 17:43:55 CST
![]() |
![]() |