- 论坛徽章:
- 7
|
回复 #1 pumk 的帖子
/* initialize svchp, stmhp, errhp, rowoff, iters, snap_in, snap_out */
/* set the execution mode to OCI_DESCRIBE_ONLY. Note that setting the mode to
OCI_DEFAULT does an implicit describe of the statement in addition to executing
the statement */
OCIParam *colhd; /* column handle */
checkerr(errhp, OCIStmtExecute(svchp, stmhp, errhp, iters, rowoff, snap_in, snap_out, OCI_DESCRIBE_ONLY);
/* Get the number of columns in the query */
checkerr(errhp, OCIAttrGet(stmhp, OCI_HTYPE_STMT, &numcols, 0, OCI_ATTR_PARAM_COUNT, errh));
/* go through the column list and retrieve the data type of each column. We
start from pos = 1 */
for (i = 1; i <= numcols; i++)
{
/* get parameter for column i */
checkerr(errhp, OCIParamGet(stmhp, OCI_HTYPE_STMT, errh, &colhd, i));
/* get data-type of column i */
checkerr(errhp, OCIAttrGet(colhd, OCI_DTYPE_PARAM, &type[i - 1], 0, OCI_ATTR_DATA_TYPE, errh));
} |
|