How does OCIDateTimeConstruct() create time values for OCI_DTYPE_DATE (DATE column)
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';
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';
0