How can I have a timestamp inserted with a row into my Oracle table

Article ID: 845
Last updated: 05 Feb, 2008
Article ID: 845
Last updated: 05 Feb, 2008
Revision: 1
Views: 17386
Posted: 15 Aug, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


I would like for the current time/date to be automatically inserted into a column when I insert a row into my table. How can I do that?


Cause


Many databases have a special column type where the date is automatically inserted into a coulmn, however, Oracle doesn't have this feature.


Action


There are two alternatives:
  • Call select sysdate from DUAL to get the system date and then insert it into table.
  • Define your table with the user_timestamp date column with DEFAULT SYSDATE.
See your Oracle documentation for details.
This article was:   Helpful | Not helpful
Report an issue
Article ID: 845
Last updated: 05 Feb, 2008
Revision: 1
Views: 17386
Posted: 15 Aug, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category