16.20 - Header Files - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

Teradata provides the sqltypes_td.h header file that you include in your source code file. The header file defines the equivalent C data types for all database data types that you can use for the input arguments and result of your UDMs. Every SQL data type corresponds to a C data type in sqltypes_td.h.

Location

The header file is in the etc directory of the Teradata software distribution:

/usr/tdbms/etc

To verify the path of the etc directory, enter the following on the command line:

pdepath -e

SQL_TEXT Definition

Before you include the sqltypes_td.h header file, you must define the SQL_TEXT constant. The value that you use must match the current server character set of the session in which you use the CREATE METHOD statement to create the UDM.

IF you use the CREATE METHOD statement when the current server character set is … THEN the C or C++ function must set SQL_TEXT to …
KANJI Kanji1_Text
KANJISJIS Kanjisjis_Text
LATIN Latin_Text
UNICODE Unicode_Text

SQL_TEXT is used for specific UDM arguments when the UDM uses parameter style SQL. For details on parameter styles, see UDM Parameter List.

Teradata Database remembers the character set the UDM was created under so that the UDM can translate SQL_TEXT input arguments to the expected text and translate text to SQL_TEXT output arguments, no matter who invokes the UDM and what the current server character set is for the session.

In accordance with Teradata internationalization plans, KANJI1 support is deprecated and is to be discontinued in the near future. KANJI1 is not allowed as a default character set; the system changes the KANJI1 default character set to the UNICODE character set. Creation of new KANJI1 objects is highly restricted. Although many KANJI1 queries and applications may continue to operate, sites using KANJI1 should convert to another character set as soon as possible.

Example: Defining SQL_TEXT and Including sqltypes_td.h

The following example shows how to define SQL_TEXT and include the sqltypes_td.h header file in the file that defines a UDM:

#define  SQL_TEXT Latin_Text
#include "sqltypes_td.h"

Alternatively, you can use the following line to include the sqltypes_td.h header file:

#include <sqltypes_td.h>

Using angle brackets (< >) or double quotation marks (" ") affects the path that the C preprocessor uses to search for the sqltypes_td.h header file.

SQL Data Types

Every SQL data type corresponds to a C data type that you use for the input arguments and result of your UDM.

For more information, see SQL Data Type Mapping.

For exact definitions, see the sqltypes_td.h header file.