Data Type Mapping Between SQL and Java - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

When you create or replace an external Java procedure, the system converts all SQL data types to or from its corresponding Java data type based on the type of parameter mapping.

External procedures default to Simple Mapping, where the SQL data types map to Java primitives or, when an appropriate primitive does not exist, to Java classes. In other words, if there is a Java type in the Simple Mapping column, the default mapping maps to that type. If the Simple Mapping column has a not applicable entry for an SQL data type, then the default mapping maps to the Java class in the Object Mapping column.

If you create or replace a Java external procedure that permits nulls to be passed to or from it, you cannot use simple mapping. To override the default mapping, you must specify the appropriate Java class from the Object Mapping column in the parameter list of the EXTERNAL NAME clause.

The following table defines the data type mapping between SQL and Java.

SQL Data Type Java Data Type
Simple Mapping Simple Mapping Java Primitive Symbol Object Mapping
BYTEINT byte B java.lang.Byte
SMALLINT short S java.lang.Short
INTEGER int I java.lang.Integer
BIGINT long J java.lang.Long
NUMERIC not available not available java.math.BigDecimal
DECIMAL not available not available java.math.BigDecimal
FLOAT double D java.lang.Double
REAL double D java.lang.Double
DOUBLE PRECISION double D java.lang.Double
BYTE not available B byte[]
VARBYTE not available B byte[]
BLOB not available not available java.sql.Blob
DATE not available not available java.sql.Date
TIME

TIME does not support the full nanosecond time granularity provided by the database.

not available not available java.sql.Time
TIMESTAMP not available not available java.sql.Timestamp
INTERVAL not available not available java.lang.String
CHARACTER not available not available java.lang.String
VARCHAR not available not available java.lang.String
CLOB not available not available java.sql.Clob
GRAPHIC not available not available not available
VARGRAPHIC not available not available not available
UDT not supported not available not supported