| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Trigger deleting :new value
Hello
I have an update trigger that is for each row.
The goal is to detect if a timestamp field is updated, if not updated
it with system timestamp.
My problem is the value of this field is lost and I end up with null
value in the table.
I am attaching my testing script
I am using Oracle 10g.
Thanks for your help.
CREATE OR REPLACE TRIGGER TU_FORWARD_FX_RATE_TS
BEFORE UPDATE ON FORWARD_FX_RATE_TS referencing new as new, old as
old
FOR EACH ROW
--WHEN (new.last_modified_timestamp is null)
BEGIN
insert into TABLE_LOG values('Trigger', systimestamp,
0, :new.LAST_MODIFIED_TIMESTAMP);
insert into TABLE_LOG values('Trigger', systimestamp,
1, :old.LAST_MODIFIED_TIMESTAMP);
IF not updating('LAST_MODIFIED_TIMESTAMP') THEN
insert into TABLE_LOG values('Trigger', systimestamp, 2, 'not
updating');
:new.last_modified_timestamp := SYSTIMESTAMP;
END IF;
END;
Test script:
drop trigger TU_FORWARD_FX_RATE_TS; Received on Tue Nov 06 2007 - 03:45:13 CST
![]() |
![]() |