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: Insert time into Oracle date field

Re: Insert time into Oracle date field

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Wed, 26 May 2004 00:50:22 GMT
Message-ID: <iRRsc.25735$af3.1335386@attbi_s51>

"Alan" <wangxianlg_at_yahoo.com> wrote in message news:18a6fc2f.0405250445.6c3f50c9_at_posting.google.com...
> Thanks Jim for your greate advice.
>
> I am just wondering if it's possible to use insert statement to insert
> 13:27 into Oracle date field. Because my application was written in
> C++ and get time value from Unix OS.
>
> Alan
>
> "Jim Kennedy" <kennedy-downwithspammersfamily_at_attbi.net> wrote in message
news:<5pxsc.111302$iF6.10141187_at_attbi_s02>...
> > "Alan" <wangxianlg_at_yahoo.com> wrote in message
> > news:18a6fc2f.0405241654.264a90a3_at_posting.google.com...
> > > Recently I try to migrate application from Unify database into Oracle.
> > > I came cross a problem. In Unify database there is time field which
> > > can store time value like 13:45. I am just wondering if it's possible
> > > to insert this time value into Oracle date field and how to insert it.
> > >
> > >
> > > Thanks in advance
> > >
> > > Alan
> >
> > update statement
> >
> > update mytab set myDateCol=to_date(to_char(myDateCol,'mm/dd/yyyy
> > ')||myTimeCol||':00','mm/dd/yyyy hh24:mi:ss'))
> >
> > Jim

You can't insert just the time into a date field. If you insert just the date in a date field it assumes the time is 00:00 (midnight). Not sure what a time alone should be in a date field. I guess you could have a fixed date (eg 1/1/1900) and add the time or store it as a number such as number of seconds from midnight or milliseconds from midnight. Jim Received on Tue May 25 2004 - 19:50:22 CDT

Original text of this message

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