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_BYTE |
byte |
TD_BYTEINT |
byte integer |
TD_CHAR |
character |
TD_DATE |
date |
TD_DATE_ANSI |
ANSI date |
TD_DECIMAL |
decimal |
TD_FLOAT |
float |
TD_GRAPHIC |
graphic |
TD_INTEGER |
integer |
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 |
-255 |
-255 |
NUMBER(*) |
-128 |
-128 |
NUMBER(*,scale) |
-128 |
scale |
NUMBER(precision) |
precision |
-255 |
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 );