Conversion Rules - Preprocessor2 for Embedded SQL

Teradata Preprocessor2 for Embedded SQL Programmer Guide

Product
Preprocessor2 for Embedded SQL
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2446
lifecycle
previous
Product Category
Teradata Tools and Utilities
  • Numeric values cannot be returned to character or byte strings. The only exception to this is DATE. DATE fields can be returned to character fields (not byte) if the length of the field can hold the conversion type requested by the precompiler DATE option. See “DATE(D|E|I|J|U) -d D|E|I|J|U” on page 71.
  • BYTE and VARBYTE strings can be returned to any valid host variable type. The byte string is moved one byte at a time for the length of the receiving variable. No data conversion is performed and the application is responsible for handling the returned data.
  • CHAR and VARCHAR strings can only be returned to CHAR or VARCHAR type variables.
  • DATE values can be returned to any numeric type (DECIMAL, NUMERIC, INTEGER, FLOAT, REAL, DOUBLE PRECISION) as long as the value is representable in the receiving type. DATE in its natural format (such as a DESCRIBE for a dynamic request) is equivalent to INTEGER.
  • DATE can also be returned to CHAR or VARCHAR fields, provided the length of the receiving field can hold the format requested. The character variable must be at least length 8 to receive the date in any of the allowable formats.

  • DECIMAL values can be returned to any numeric type (DECIMAL, NUMERIC, INTEGER, SMALLINT, BYTEINT, FLOAT, REAL, DOUBLE PRECISION) as long as the value is representable in the receiving type.
  • BYTEINT, SMALLINT and INTEGER values can be returned to any numeric type (DECIMAL, NUMERIC, INTEGER, SMALLINT, BYTEINT, FLOAT, REAL, DOUBLE PRECISION) as long as the value is representable in the receiving type.
  • FLOAT values can be returned to any numeric type (DECIMAL,NUMERIC, INTEGER, SMALLINT, BYTEINT, FLOAT, REAL, DOUBLE PRECISION) as long as the value is representable in the receiving type.
  • The Teradata SQL FLOAT, REAL and DOUBLE PRECISION types are equivalent to a DOUBLE PRECISION FLOAT. PP2 recognizes SINGLE and DOUBLE PRECISION FLOAT host variable types. Fractional portions of the value might be lost in conversion to a type other than DOUBLE PRECISION FLOAT.

  • GRAPHIC and VARGRAPHIC strings can only be returned to GRAPHIC or VARGRAPHIC type variables.