Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Dates in OCI

Re: Dates in OCI

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 17 Sep 1999 06:43:58 -0400
Message-ID: <KxviN6M=4kwfdR8WT2sZL7NVGKBm@4ax.com>


A copy of this was sent to Edward Chan <ballgod_at_yahoo.com> (if that email address didn't require changing) On Fri, 17 Sep 1999 05:17:31 GMT, you wrote:

>I'm writing an OCI application that deals with dates and times. My
>problem is this: I need to execute a query, that is generated
>dynamically, so I don't know what the types are for the select list
>items. But that's not my problem. Getting the type is easy. The
>problem is when I encounter columns that return SQLT_DAT for the type
>code. From this type code, I cannot determine whether the column is
>used for only the time portion, or only the date portion, or both.
>
>In ODBC, there are type codes like SQL_DATE, SQL_TIME, SQL_TIMESTAMP that
>distinguishes between the different types. Is there something like this
>for OCI? How would I store just the time, or just the date portions?
>
>If I call OCIDefineByPos() using SQLT_DAT (which was what I determined
>the column type to be), I will get back all 7 bytes of the date (Oracle
>stores dates as 7 bytes). But I have no way of determining whether the
>column stores times, dates, or timestamps (date/time).
>
>In short, how would I store just time, or just date using OCI? And how
>do I determine what the column stores, just time, or just date? The type
>code SQLT_DAT doesn't tell me the information I need to know.
>

Currently, in Oracle8.1.5 and before, dates are a 7byte field that store the date and time.

SQLT_DAT is *always* a date/time variable.

There is no 'time' variable.
There is no 'just a date' variable.

They always store 'timestamps'.

>Thanks for any suggestions.
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Sep 17 1999 - 05:43:58 CDT

Original text of this message

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