OCI: Convert integer to DATE when binding for inserts??
Date: Thu, 16 Jan 2003 18:48:12 +0100
Message-ID: <3E26F05C.8000205_at_unispeed.com>
Hi,
I have tried to convert an integer (unixtime) to DATE inside OCI.
I'm doing an array binding and I want to convert an integer (C-type) to a Oracle DATE format when inserting.
I have tried to convert the integer to excess-100 notation (7 bytes) but the values I get when selecting from table after insert are incorrect.
The table is as follows:
Name Null? Type
------------- -------- ---------------------------- TIME DATE UT FLOAT(126)
select to_char(time, 'Dy DD-Mon-YYYY HH24:MM:SS'), ut from oracle_table;
TO_CHAR(TIME,'DYDD-MON-Y
UT
------------------------ ----------
Thu 16-Jan-2003 17:01:40 1042737521
This is wrong!
I use OCIBindByPos when binding. The 7 bytes located at the storage when binding looks like this:
Byte 1 2 3 4 5 6 7 value 120 103 1 16 18 19 42
I use SQLT_DAT when binding and size 7.
As far I can tell from Oracle documentation this should be 'Thu 16-Jan-2003 17:18:41'
but I get 'Thu 16-Jan-2003 17:01:40'?
Does anybody know how I can convert integer to DATE format when binding? Cant I use this 7-byte notation when binding? What should I do then?
Thanks in advance!
Ole Hansen
Received on Thu Jan 16 2003 - 18:48:12 CET