OCI Insert order changes DATE value.
Oracle 64bit (11.1.0.6.0, 11.2.0.1.0). This is my test table:
SQL> desc test_date_float_date;
Name Null? Type
----------------------------------------- -------- -------------
TYPE_DATE1 DATE
TYPE_DEC FLOAT(126)
TYPE_DATE2 DATE
OraText *insert = (OraText *) "INSERT INTO test_date_float_date(type_date1, type_dec, type_date2) VALUES (:ph1, :ph2, :ph3)";
bRc = checkerr(errhp,
OCIDateTimeConstruct(envhp, errhp, v_datetime,
(sb2)2012, (ub1)7, (ub1)19, (ub1)0, (ub1)0, (ub1)0, (ub4)0,
(OraText *) timezone, 5));
bRc = checkerr(errhp,
OCIDateTimeConstruct(envhp, errhp, v_datetime2,
(sb2)2012, (ub1)7, (ub1)19, (ub1)0, (ub1)0, (ub1)0, (ub4)0,
(OraText *) timezone, 5));
NOTE:
I am working on another post about what is the correct value for time (h,m,s,f) to set to OCIDateTime for DATE (OCI_DTYPE_DATE). Using different time value doesn't change the outcome of test cases.
SQL> desc test_date_float_date;
Name Null? Type
----------------------------------------- -------- -------------
TYPE_DATE1 DATE
TYPE_DEC FLOAT(126)
TYPE_DATE2 DATE
OraText *insert = (OraText *) "INSERT INTO test_date_float_date(type_date1, type_dec, type_date2) VALUES (:ph1, :ph2, :ph3)";
bRc = checkerr(errhp,
OCIDateTimeConstruct(envhp, errhp, v_datetime,
(sb2)2012, (ub1)7, (ub1)19, (ub1)0, (ub1)0, (ub1)0, (ub4)0,
(OraText *) timezone, 5));
bRc = checkerr(errhp,
OCIDateTimeConstruct(envhp, errhp, v_datetime2,
(sb2)2012, (ub1)7, (ub1)19, (ub1)0, (ub1)0, (ub1)0, (ub4)0,
(OraText *) timezone, 5));
NOTE:
I am working on another post about what is the correct value for time (h,m,s,f) to set to OCIDateTime for DATE (OCI_DTYPE_DATE). Using different time value doesn't change the outcome of test cases.
0