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: Oracle Timestamps

Re: Oracle Timestamps

From: Ulrik Hoffmann <ulrik_at_hoffmann-kiel.de>
Date: Mon, 24 May 1999 14:09:22 +0100
Message-ID: <7ibfgd$ri5$1@freeside.cls.net>

> Is anybody here know if we can use the timestamps of Oracle in an
> application ?
> By timestamps, I mean the one which are updated when a row in inserted or
> updated.
> And if yes, how can we ??
>
> Thanks
>
> Pascal
>
> pbrenner_at_technologist.com
>
>

You must have two (or one) extra-fields in your table, like 'DateCreated' and
'DateChanged' of format date. Then you need a trigger on the table like

Create Or Replace Trigger TR_MyTable_BIU befor insert or update on Mytable for each row
is
begin
  if inserting then
    :new.datecreated:=sydate;
 end if;
if updating then
  :new.datechanged:=sysdate;
end if;
end;

Remember the : before new!

Greetings
Uli Received on Mon May 24 1999 - 08:09:22 CDT

Original text of this message

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