Trigger won't update timestamp??! [message #38582] |
Mon, 29 April 2002 02:34 |
Kai-Uwe Tack
Messages: 1 Registered: April 2002
|
Junior Member |
|
|
Hello,
I defined a trigger like that:
create or replace trigger OnUpdate
before update on Worker
for each row
begin
:new.tstamp := localtimestamp;
:new.UName := UPPER(:new.Name);
dbms_output.put_line( :new.tstamp || ', ' || :new.UName );
end OnUpdate;
It should set a column named 'tstamp' of type TIMESTAMP to the date & time of the last modification and set a column 'UName' with the upcased contents of column 'Name'.
The latter works fine, but tstamp doesn't get updated! Up to the put_line() all seems OK, :new.tstamp shows the correct value. But this value never really makes it into the table!?
Anybody any ideas?
Kind regards, Kai-Uwe Tack.
|
|
|
Re: Trigger won't update timestamp??! [message #38584 is a reply to message #38582] |
Mon, 29 April 2002 04:20 |
Vikas Gupta
Messages: 115 Registered: February 2002
|
Senior Member |
|
|
Hello,
I have updated the trigger as follows and works fine
with me:
create or replace trigger OnUpdate
before update on Tstamp
for each row
declare
localtimestamp date;
begin
select sysdate into localtimestamp from dual;
:new.tstamp := localtimestamp;
:new.UName := UPPER(:new.Name);
dbms_output.put_line( :new.tstamp || ', ' || :new.UName );
end OnUpdate;
Regards.
Vikas Gupta.
|
|
|