Re: SYSDATE for a default value

From: Klaus Sonnenleiter <klaus_at_m-machine.com>
Date: Mon, 28 Jun 1999 16:32:22 GMT
Message-ID: <3777A2D2.ED830B4E_at_m-machine.com>


David,

create table foo_tab (
  id number primary key,
  your_date date default sysdate);

You can also use a trigger - that would enforce that there will always be the timestamp of the insert action in this field.

Klaus Sonnenleiter
The Media Machine, LLC

David Rabsch wrote:

> Hi, I'm a newbie, so please excuse this if it's an elementary
> question.....
>
> I want to have the default value in a table be the current date and
> time, and found the function SYSDATE. Seems like the right thing to
> do. My question is, how do I put the result of SYSDATE into the field?
> What's the correct syntax? Do I use a trigger on the table, and if so,
> when? I've already got one trigger to automatically increase a value in
> an ID field by one every time a new field is inserted and it works
> great, but I tried to do the same thing with the SYSDATE function with
> no luck. I'm coming over from Access, so my sql (and esp. PL/SQL) is
> horrible. Thx for the help.
Received on Mon Jun 28 1999 - 18:32:22 CEST

Original text of this message