Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Trigger

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello
I've got a proplem. I need a trigger that inserts the date in the column "creationDate" of the table "audittrail" when a new dataset is inserted.
And a trigger that inserts the date in the column "ModifiedDate" of the table "audittrail" when a dataset was updated is inserted.
Can anyone help me?
 
It's Oracle 8.1.7
But I guess found a solution...
CREATE OR REPLACE TRIGGER myTrigger BEFORE UPDATE OF columns ON tablel FOR EACH ROW
BEGIN
:new.creationDate:= sysdate;
END;
/

But in which format is it's saved in the Database?
when I insert a value in the table and make a select *
the date is e.g. 24-01-02 ... can I also ask for the time?
 
Why would you care what format it is stored in, when you select the date give the format you want ('yyyy/mm/dd hh:mi:ss') and if you include time in the format it should display it !

Look in your documentation for the available date formats ! :)
 
I tried this, but when displying the time, there is always 00:00:00!
Why there's not the exact time, when the dataset has been saved?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top