Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> OCI: How to retrieve simple types other than Strings
Hi there,
from my C++ application I have problems retrieving any adata other than Strings (VARCHAR2) from the Oracle815 database. (OCI is 8.1.6). When I select something simple like:
SELECT 1 AS Test, user AS USR FROM DUAL
it turns out that I get the correct user name but the number is garbage. I do:
OCIDefineByPos(
(OCIStmt*) pOCIStatement, //stmt handle
(OCIDefine**) &ptrDefineHandle, //define handle
(OCIError*) pOCIError, //error handle
(ub4) counter, //position
(dvoid*) ptrValue, //value pointer
(sb4) col_len, //value size
(ub2) dtype, //data type
(dvoid*) 0, //indp
(ub2*) ptrLength, //rlenp
(ub2*) 0, //rcodep
(ub4) OCI_DEFAULT //mode
);
.. where dtype is 2 for the Test column (NUMBER). When I fetch, i find garbage in the ptrValue. How do I trurn it into the value "1" from the statement ? For the 2nd column ptrValue points to a C string giving the user name. Of course I have ptrValue for each of the columns separately. Do I have to call something like OCINumberToInt or so on ptrValue ? How do I know what to call ? Thanks,
Andre
:(
Received on Tue Dec 04 2001 - 03:59:36 CST
![]() |
![]() |