Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Adding a date column in Oracle 9i

Re: Adding a date column in Oracle 9i

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Fri, 5 May 2006 14:38:19 -0400
Message-ID: <bcudnSl8g5cBBsbZnZ2dnUVZ_vSdnZ2d@comcast.com>

<laredotornado_at_zipmail.com> wrote in message news:1146851256.416441.271790_at_y43g2000cwc.googlegroups.com...
: Hi,
:
: How, if at all, could I add a column to a table in Oracle 9i in which
: the column would record time and date, and its default value would be
: the time the row was inserted. My objective is to avoid editing SQL
: statements to include "SYSDATE" calls. What I would like is taht
: whenever a row is INSERTED, the time the row was inserted is recorded
: in this new column I create.
:
: I don't want anything to happen on UPDATEs.
:
: Thanks, - Dave
:

use 'alter table add' to add a column
use the 'default' clause to have the default value on insert be sysdate however, since users can override default values, create a BEFORE INSERT -- FOR EACH ROW trigger on the table to force the column value to sysdate (many examples available by googling)

++ mcs Received on Fri May 05 2006 - 13:38:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US