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

Home -> Community -> Usenet -> c.d.o.server -> Re: TIMESTAMP in field during INSERT operation only

Re: TIMESTAMP in field during INSERT operation only

From: Ton <76434.1353_at_compuserve.com>
Date: 20 Jan 2003 00:31:05 -0800
Message-ID: <4477604.0301200031.18f8984b@posting.google.com>


Kenneth,

I think we have an misunderstanding:

What I need is the right syntax to set this up. (maybe insert before trigger??)
Anyway thanks for the earlier response you send me.     

> Hi,
>
> To ensure that current timestamp is inserted on INSERT :
>
> Create table A(c1 number(10) ,B date default SYSDATE);
>
> Then :
> insert into A(c1) values (1);
>
> OR
> insert into A values (1,DEFAULT);
>
> Of course this does not itself prevent programmers from issuing
> inserts like
> insert into A(c1) values (1,SYSDATE-1000);
>
> or updates like
>
> update A set B = sysdate + 1000 where.....;
>
> In both cases you need a trigger to prevent it, because Oracle
> provides no functionality of defining a column value as CONSTANT once
> inserted. A check constraint is not capable of this either, as it
> does not accept SYSDATE expressions.
>
>
> - Kenneth Koenraadt
>
>
>
> To ensure that this field is
Received on Mon Jan 20 2003 - 02:31:05 CST

Original text of this message

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