15.10 - Number Data Types - ODBC Driver for Teradata

ODBC Driver for Teradata User Guide

prodname
ODBC Driver for Teradata
vrm_release
15.10
category
User Guide
featnum
B035-2509-035K

The Teradata Database Number data types are available in ODBC if supported by the database. A Teradata Database Number type is either Fixed or Floating.

 

Table 46: NUMBER Data Types 

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 ODBC 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:

  • SQL_TD_FIXED_NUMBER for a Fixed Number
  • SQL_TD_FLOATING_NUMBER for a Floating Number
  • Note: 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” on page 100.