Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: TIMESTAMP in field during INSERT operation only
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