Home » SQL & PL/SQL » SQL & PL/SQL » Trigger on a Table
Trigger on a Table [message #20029] Thu, 25 April 2002 09:07 Go to next message
Arpit
Messages: 99
Registered: March 2001
Member
Hello All,

I need some help in order to write a trigger on a table.

In one of my tables when the record is modified, it doesn't change the "date_modified" for the record. I need to force it to have the "date_modified" for any update on records defaulting it to the system date.

How can i write a trigger on this particular table forcing it to assing the "date_modified" to system date.

Any help on this would be highly appreciated.

Thanks
Re: Trigger on a Table [message #20031 is a reply to message #20029] Thu, 25 April 2002 09:57 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
create or replace trigger trig_name
before update on table_name
for each row
begin
  :new.date_modified := sysdate;
end;
/
Re: Trigger on a Table [message #20051 is a reply to message #20031] Fri, 26 April 2002 10:08 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
If you are the owner of the table, you can just go ahead and run the script. If not, you will need some privileges granted to you.
Previous Topic: Re: HOW TO CONVERT NUMBER TO WORD FORMAT WHERE NUMBER HAVING MORE THEN 5373484
Next Topic: ORA-06502, ORA-06512 and pad string errors
Goto Forum:
  


Current Time: Thu Mar 28 11:25:08 CDT 2024