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: Timestamp of a record

Re: Timestamp of a record

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Thu, 11 Dec 2003 07:56:50 -0500
Message-ID: <YqGdnV8g0cVZ9EWiRVn-jg@comcast.com>

"Daniel Morgan" <damorgan_at_x.washington.edu> wrote in message news:1071074643.721508_at_yasure...
| NoName wrote:
|
| >>nope, not unless you have added a column to track that.
| >
| >
| > you mean, I can provide an
| > ALTER TABLE table ADD <a column> TIMESTAMP DEFAULT SYSDATE
| > statement, so every time a row is inserted, I get the exact moment...
| >
| > OK, that's a solution, thank you very much.
| >
| > Regards
| >
|
| Actually you can't. SYSDATE is not a TIMESTAMP. Try this instead:
|
| ALTER TABLE <table_name>
| ADD <column_name> TIMESTAMP DEFAULT SYSTIMESTAMP;
|
| It will work a lot better.
|
| --
| Daniel Morgan
| http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
| http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
| damorgan_at_x.washington.edu
| (replace 'x' with a 'u' to reply)
|

but keep in mind that a default can be overridden with another value or with NULL -- it is only applicable if the column is not referenced in the INSERT statement

to be absolutely sure you're always getting the real time, populate the field with a trigger (which is also the way to track time of last update)

Received on Thu Dec 11 2003 - 06:56:50 CST

Original text of this message

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