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: inserts with automatic time stamp

Re: inserts with automatic time stamp

From: raman batra <rrbatra_at_feist.com>
Date: Thu, 03 Sep 1998 04:23:02 GMT
Message-ID: <35EDFEF1.634E@feist.com>


In your table you could declare a date field as create table table_name (
other columns and their definition,
my_date_column date default sysdate
)

This should automatically capture sysdate on inserts.

In Oracle you have only one date field. You can format mask it to retrieve time if you need.

Barry L. Wallis wrote:
>
> Bernd Goetz wrote in message <35ED14BB.658DA52F_at_tarsec.com>...
> >Hi
> >
> >I've got a log table in which I also want to store the current date and time. I do it like this:
> >
> ><<
> >insert into applog (pname, pversion, type, userid, created, msg)
> > values ('PL', '0.9.0', 'LOGON', 'bgo',
> > to_date(to_char(sysdate, 'MM/DD/YYYY HH24:MI:SS'), 'MM/DD/YYYY HH24:MI:SS'),
> > 'by hand')
> >>>
> >
> >I didn't find another way of solving this. What do you think? Did I miss something? btw: this is
> >important: I want to keep the database format as independent from any specialities of Oracle as
> >possible. Hence no special purpose current time data types are allowed.
>
> [...]
>
> Maybe someone with more knowledge of the SQL standard can comment, but, I think everything used to populate the 'created' column is specific to Oracle (hence, special purpose).
> --
> Barry L. Wallis, Senior Systems Engineer
> Science Applications International Corporation
> 4161 Campus Point Court
> San Diego, CA 92121
>
> voice: (619) 646-9891, fax: (619) 646-9327
> mailto: Barry.L.Wallis_at_cpmx.saic.com
> _______________________________________________________
>
> ---------------------------------------------------------------
>
> Name: Barry L. Wallis.vcf
> Part 1.2 Type: unspecified type (application/octet-stream)
> Encoding: quoted-printable
Received on Wed Sep 02 1998 - 23:23:02 CDT

Original text of this message

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