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: Timestamping records automatically

Re: Timestamping records automatically

From: DA Morgan <damorgan_at_psoug.org>
Date: Sat, 06 Oct 2007 00:16:53 -0700
Message-ID: <1191655001.795091@bubbleator.drizzle.com>


Arch wrote:
> I need to add a date / time stamp to records as they are inserted into
> a table. I need to do this at the server end.
>
> Is there a "correct" way to do that? Should I simply use a default
> value of sysdate? Or should this be done with a trigger or something
> else?
>
> Thanks for any advice

CREATE TABLE t (
col1 VARCHAR2(20),
col2 DATE DEFAULT SYSDATE);

INSERT INTO t
(col1)
VALUES
('AAA'); SELECT * FROM t;

Documented in Morgan's Library at www.psoug.org under HEAP TABLES.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Sat Oct 06 2007 - 02:16:53 CDT

Original text of this message

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