Precompilers and OCI (MOSC)

MOSC Banner

How to get the first field value for "SELECT 1 AS ID, COUNT(*) AS NUM FROM SAMPLE_TABLE;" with OCI i

edited Jun 18, 2012 8:37PM in Precompilers and OCI (MOSC) 2 commentsAnswered
I executed the following SQL through OCI interface:
SELECT 1 AS ID, COUNT(*) AS NUM FROM SAMPLE_TABLE;

called:
OCIAttrGet(attr, OCI_DTYPE_PARAM, &datatype, 0, OCI_ATTR_DATA_TYPE, error);
OCIAttrGet(attr, OCI_DTYPE_PARAM, &precision, 0, OCI_ATTR_PRECISION, error);
OCIAttrGet(attr, OCI_DTYPE_PARAM, &scale, 0, OCI_ATTR_SCALE, error);
OCIAttrGet(attr, OCI_DTYPE_PARAM, &datasize, 0, OCI_ATTR_DATA_SIZE, error);

and results were: datatype=2(SQLT_NUM), precision=0, scale=-127 and datasize=2. What kind of data type is it?

I tried to convert the field value (i think it should be 1.) to bigint using OCINumberToInt(error, buff, sizeof(DB_INT64), OCI_NUMBER_SIGNED, pValue), i got "ErrMsg: OCI-22054: underflow error".

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center