Number Data Types - ODBC Driver for Teradata

ODBC Driver for Teradata® User Guide

Product
ODBC Driver for Teradata
Release Number
17.10
Published
October 2021
Language
English (United States)
Last Update
2021-11-02
dita:mapPath
wxs1608578396899.ditamap
dita:ditavalPath
nkw1500504256726.ditaval
dita:id
B035-2526
lifecycle
previous
Product Category
Teradata Tools and Utilities

The Number data types are available to an ODBC application if supported by the database. A Number type is either Fixed or Floating as listed in the following table.

Number Variant Database Type Description
Fixed Number NUMBER (p, s) Fixed decimal of p digits with s fractional digits
NUMBER (p) Equivalent to NUMBER(p, 0)
Floating Number NUMBER (*, s) Floating decimal of s fractional digits
NUMBER (*) Floating decimal
NUMBER Equivalent to NUMBER(*)

In an ODBC application, the Number types are treated as standard SQL types. Fixed Number data types are mapped to the standard SQL_DECIMAL data type and Floating Number data types are mapped to SQL_DOUBLE. This means conforming applications do not need to know that the database type corresponding to an SQL_DECIMAL or SQL_DOUBLE is a Number data type.

If an application needs information indicating the database type is a Number type, then the application can examine the Teradata ODBC-specific data type code. This code is returned as a descriptor field in SQLColAttribute and SQLGetDescField. Additionally, the code is returned as a Teradata-specific column in the result set from SQLGetTypeInfo, SQLColumns, and SQLProcedureColumns.

The Teradata ODBC-specific data type codes are as follows:
  • SQL_TD_FIXED_NUMBER for a Fixed Number
  • SQL_TD_FLOATING_NUMBER for a Floating Number
The names SQL_TD_FIXED_NUMBER and SQL_TD_FLOATING_NUMBER are defined in the tdsql.h file. For more information, see Teradata Extensions to the ODBC Standard.