Length of LONG column in OCI?
Date: Mon, 27 Mar 2000 07:18:25 -0800
Message-ID: <053064d2.82a5f549_at_usw-ex0103-023.remarq.com>
Hi.
I have an OCI problem with Oracle8i.
I have this program in which I first use OCIAttrGet() to describe the length of columns (the OCI_ATTR_DATA_SIZE), then allocate the same amount of memory for a string by OCIStringResize() and finally define the string with OCIDefineByPos().
This works superfine until I try it on a column containing the LONG data type in which case OCIAttrGet returns 0.
So, how do I instead get to find out the size of a LONG column before allocation? Surely it must be possible?
Thanks,
Jens.
My code:
/* The next statements describe the select-list item and
return its length */
checkerr(errhp, OCIParamGet(stmthp, OCI_HTYPE_STMT, errhp,
(dvoid**) &parmdp, (ub4) colnr));
checkerr(errhp, OCIAttrGet((dvoid*) parmdp, (ub4)
OCI_DTYPE_PARAM, (ub4*) &deptlen, NULL, (ub4)
OCI_ATTR_DATA_SIZE, (OCIError *) errhp ));
/* Allocate memory for string */
checkerr(errhp, OCIStringResize(envhp, (OCIError *) errhp,
(ub2) deptlen + 1, (OCIString **) strPointer));
/* bind the input variable */
checkerr(errhp, OCIDefineByPos(stmthp, &defnp, errhp, (ub4)
colnr, (dvoid *) strPointer, (sword) (ub2) deptlen + 1,
SQLT_VST, (dvoid *) 0, (ub2 *) rlenp, (ub2 *) 0, OCI_DEFAULT));
- Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!