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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last_Dated Updated

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi!
I have a requirement that says any time a user
makes any changes to the application, it the date
of the change must be recorded.
As a result, there is a field called las_date_updated.
This field has a default value of sysdate which I think is
wrong because any time you run the form, the sysdate automatically display on the form.
That is not what I want. I want this date to display only after an update is made. Can anyone give me the syntax?
thanks,
tankem
 
Remove the sysdate default value and create a post-update trigger containing the code:

:block.date_item := SYSDATE;
 
Write the code provided by Lewisp, but in pre-insert/pre-update triggers, otherwise you'll see real sysdate, not the value stored in database.
You may also create database trigger before update/insert with :new.last_date_updated:= sysdate; in it. This prevents users from updating this field from other applications (sql*plus or other form). In this case you have to select this database derived value in post-update.
 
thank you sem and lewisp(again).
First I removed the default sysdate from my table with an alter statement (I think).
Then I used the syntax from lewisp on pre insert/update trigger and then on post_update.
When I queried the form, without many any changes to it,
I am still seeing current date being displayed.
Did I miss something?
Thanks again to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top