C to SQL: Numeric

There are a total of ten HCL OneDB™ ODBC Driver C data types.

The numeric HCL OneDB ODBC Driver C data types are:
  • SQL_C_DOUBLE
  • SQL_C_FLOAT
  • SQL_C_LONG
  • SQL_C_SHORT
  • SQL_C_SLONG
  • SQL_C_STINYINT
  • SQL_C_TINYINT
  • SQL_C_ULONG
  • SQL_C_USHORT
  • SQL_C_UTINYINT
The following table shows the HCL OneDB ODBC Driver SQL data types to which numeric C data can be converted.

The HCL OneDB ODBC Driver SQL data types to which numeric C data can be converted.

fSqlType Test SQLSTATE
SQL_BIGINT Data converted without truncation. N/A
Data converted with truncation of fractional digits. 01004
Conversion of data would result in loss of whole (as opposed to fractional) digits. 22003
SQL_BIT Data is 0 or 1. N/A
Data is greater than 0, less than 2, and|not equal to 1. 01004
Data is less than 0 or greater than or equal to 2. 22003
SQL_CHAR

SQL_LONGVARCHAR

SQL_VARCHAR

Number of digits < Column length. N/A
Number of whole (as opposed to fractional) digits < Column length. 01004
Number of whole (as opposed to fractional) digits > Column length. 22003
SQL_DECIMAL

SQL_INTEGER

SQL_SMALLINT

Data converted without truncation N/A
Data converted with truncation of fractional digits. 01004
Conversion of data would result in loss of whole (as opposed to fractional) digits. 22003
SQL_DOUBLE

SQL_REAL

Data is within the range of the data type to which the number is being converted. N/A
Data is outside the range of the data type to which the number is being converted. 22003

HCL OneDB ODBC Driver ignores the value that the pcbValue argument of SQLBindParameter points to and the value of the cbValue argument of SQLPutData when it converts data from the numeric C data types. HCL OneDB ODBC Driver uses the size of rgbValue for the size of the numeric C data type.