Retrieving Number Data

ODBC Driver for Teradata® User Guide

prodname
ODBC Driver for Teradata
vrm_release
16.20
category
User Guide
featnum
B035-2526-108K

The Teradata Database Fixed Number types are mapped to SQL_DECIMAL. The standard SQL_DECIMAL to ODBC C type conversions apply with the following notes:

  • Conversion to SQL_C_BINARY yields the binary representation of the Number value consisting of 1-byte length, 2-byte scale, and 1-17 bytes unscaled value.
  • Conversion to SQL_C_DOUBLE or SQL_C_FLOAT may lose precision. In this case the return code from the conversion will be SQL_SUCCES_WITH_INFO and SQLSTATE 01S07 generates.

Teradata Database Floating Number types are mapped to SQL_DOUBLE. The standard SQL_DOUBLE to ODBC C type conversions apply with the following notes:

  • Conversion to SQL_C_CHAR or SQL_C_WCHAR preserves the full precision of the Floating Number, which may be greater than the current maximum of 15. The format of the string is an ODBC numeric literal using either exponential notation or non-exponential notation depending on the actual value.
  • Conversion to SQL_C_DOUBLE (default conversion) or SQL_C_FLOAT may lose precision. In this case the return code from the conversion is SQL_SUCCES_WITH_INFO and SQLSTATE 01S07 is generated.
  • Conversion to SQL_C_BINARY yields the binary representation of the Number value consisting of 1-byte length, 2-byte scale, and 1-17 bytes unscaled value.