Precompilers and OCI (MOSC)

MOSC Banner

How does OCIDateTimeConstruct() create time values for OCI_DTYPE_DATE (DATE column)

edited Jul 31, 2012 10:07PM in Precompilers and OCI (MOSC) 10 commentsAnswered ✓
Hello all,
Oracle version 11.1.0.6.0

Please help as I find very weird behavior and there is not enough example or document to explain:

This is my test table:

SQL> desc test_date;
 Name                                                  Null?    Type
 ----------------------------------------------------- -------- -------------
 CVARCHAR2                                                      VARCHAR2(10)
 CDATE                                                 NOT NULL DATE

 
I called this to initialize my date value:
OCIDateTimeConstruct(envhp, errhp, v_datetime, 2012, 7, 18, 0, 0, 0, 0, NULL, 0);

After insert using OCIBindByName(), my table has:

SQL> select cvarchar2, cdate, dump(cdate, 10) from test_date;
CVARCHAR2  CDATE
---------- ---------
DUMP(CDATE,10)
-----------------------------------------------------------------------------
AAA        18-JUL-12
Typ=12 Len=7: 120,112,7,18,0,0,0


[Query 1]
SQL> select * from test_date where cdate = '18-JUL-12';
no rows selected


[Query 2]
SQL> select * from test_date where cdate < '18-JUL-12';

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center