TD_DataType
For use with the AddColumn function in the schema object. The following table defines data type for each column in the schema. See SQL Data Types and Literals for detailed information on each data type including an explanation of precision and scale for the decimal type and length and precision for the period data type.
Constant |
Data Type |
TD_BIGINT |
big integer |
TD_BLOB |
inline BLOB (Binary Large Object) |
TD_BLOB_AS_DEFERRED_BY_NAME |
deferred BLOB |
TD_BYTE |
byte |
TD_BYTEINT |
byte integer |
TD_CHAR |
character |
TD_CLOB |
inline CLOB (Character Large Object) |
TD_CLOB_AS_DEFERRED_BY_NAME |
deferred CLOB |
TD_DATE |
date |
TD_DATE_ANSI |
ANSI date |
TD_DECIMAL |
decimal |
TD_FLOAT |
float |
TD_GRAPHIC |
graphic |
TD_INTEGER |
integer |
TD_JSON |
inline JSON (JavaScript Object Notation) |
TD_JSON_AS_DEFERRED_BY_NAME |
deferred JSON |
TD_LONGVARCHAR |
long variable length character |
TD_LONGVARGRAPHIC |
long variable length graphic |
TD_NUMBER |
fixed / floating point decimal |
TD_PERIOD_DATE |
period(date) |
TD_PERIOD_TIME |
period(time) |
TD_PERIOD_TIME_TZ |
period(time with time zone) |
TD_PERIOD_TS |
period(time stamp) |
TD_PERIOD_TS_TZ |
period(time stamp with time zone) |
TD_SMALLINT |
small integer |
TD_VARBYTE |
variable length byte |
TD_VARCHAR |
variable length character |
TD_VARGRAPHIC |
variable length graphic |
On Specifying Data Types
Note the following when specifying data types:
The (n) corresponds to the precision of the column. The precision of these columns can be an integer from zero to six. Six is the default if no precision is specified. The PERIOD(DATE) data type has no precision.
The NUMBER data type is a variable length numeric column with the following external specification:
<1-byte Length><2-bytes Scale><1 to 17 bytes 2's complement representation of the unscaled value in the client-appropriate endianness>
schema -> AddColumn("Number_dt", TD_NUMBER, 18, 5, 2); Length = 18, Precision = 5, Scale = 2.
Number(*, 4) is represented as schema -> AddColumn("Number_dt", TD_NUMBER, 18, -128, 4); Length = 18, Precision = -128, Scale = 4
If NUMBER is... |
Precision Passed to Operator is... |
Scale Passed to Operator is... |
NUMBER |
-128 |
-128 |
NUMBER(*) |
-128 |
-128 |
NUMBER(*,scale) |
-128 |
scale |
NUMBER(precision) |
precision |
0 |
NUMBER(precision, |
precision |
scale |
CREATE TYPE pnum AS CHAR(10) ARRAY[2];
Create table emp(Associate_Id integer, phone_nums pnum);
schema -> AddColumn("phone_nums", TD_VARCHAR, 47);
Note: The insert statement for the Array data type is:
INSERT INTO target_table ( :Associate_Id, :phone_nums );
Note: JSON Datatypes are TD_JSON and TD_JSON_AS_DEFERRED_BY_NAME.
Note: LOB data types are TD_BLOB, TD_CLOB, TD_BLOB_AS_DEFERRED_BY_NAME, and TD_CLOB_AS_DEFERRED_BY_NAME.