Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: inserts with automatic time stamp
Wed, 02 Sep 1998 11:49:47 +0200, Bernd Goetz <goetz_at_tarsec.com>
rambled:
><<
>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.
What's wrong with just using SYSDATE? The way Oracle stores the date is irrelevant, you can select it out of the database in whatever form you want. Therefore, the insert and retrieval pair is:
insert into applog (pname, pversion, type, userid, created, msg) values ('PL', '0.9.0', 'LOGON', 'bgo', sysdate, 'by hand')
and
select pname, pversion, type, userid,
to_char(created, 'MM/DD/YYYY HH24:MI:SS'), msg from applog
Mark Styles
Spam my account, lose your account. Clear enough?
Religious tolerance is an oxymoron.
Received on Wed Sep 02 1998 - 07:32:44 CDT
![]() |
![]() |