数据类型
数据类型 |
输入 |
输出 |
---|---|---|
数值类型 |
BIGINT |
BIGINT |
BYTEINT |
SMALLINT |
|
DECIMAL [(n[,m])] |
DECIMAL [(n[,m])] |
|
DOUBLE PRECISION |
DOUBLE PRECISION |
|
FLOAT |
DOUBLE PRECISION |
|
INT / INTEGER |
INTEGER |
|
NUMBER / NUMERIC |
NUMERIC |
|
NUMBER(n[,m]) |
NUMERIC (n[,m]) |
|
REAL |
REAL |
|
SMALLINT |
SMALLINT |
|
字符类型 |
CHAR[(n)] / CHARACTER [(n)] |
CHAR(n) |
CLOB |
CLOB |
|
LONG VARCHAR |
TEXT |
|
VARCHAR(n) / CHAR VARYING(n) / CHARACTER VARYING(n) |
VARCHAR(n) |
|
日期/时间类型 |
DATE |
DATE |
TIME [(n)] |
TIME [(n)] |
|
TIME [(n)] WITH TIME ZONE |
TIME [(n)] WITH TIME ZONE |
|
TIMESTAMP [(n)] |
TIMESTAMP [(n)] |
|
TIMESTAMP [(n)] WITH TIME ZONE |
TIMESTAMP [(n)] WITH TIME ZONE |
|
范围类型 |
PERIOD(DATE) |
daterange |
PERIOD(TIME [(n)]) |
tsrange [(n)] |
|
PERIOD(TIME WITH TIME ZONE) |
tstzrange |
|
PERIOD(TIMESTAMP [(n)]) |
tsrange [(n)] |
|
PERIOD(TIMESTAMP WITH TIME ZONE) |
tstzrange |
|
二进制类型 |
BLOB[(n)] |
blob |
BYTE[(n)] |
bytea |
|
VARBYTE[(n)] |
bytea |
BYTEINT
输入:
SELECT cast(col as byteint) FROM tab;
输出:
SELECT CAST( col AS SMALLINT ) FROM tab ;