Re: SYSDATE for a default value
Date: 29 Jun 1999 19:49:07 GMT
Message-ID: <01bec268$70ba2fb0$2bd998c2_at_tp>
You can use DEFAULT clause (as it's shown in previous posts), or you can use trigger. I recommend DEFAULT clause - whenever you can, you should use declarative solutions.
It's possible to use trigger (FOR EACH ROW), e.g.:
BEGIN
...
:NEW.time_stamp:=SYSDATE;
...
END;
will solve the problem.
Hope this helps,
Mario
P.S. It's possible to automatically increase number values by using database sequences.
David Rabsch <DRabsch_at_palliser.ca> wrote in article
<37778763.509CF5FC_at_palliser.ca>...
> 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 Tue Jun 29 1999 - 21:49:07 CEST