Updated on 2024-07-19 GMT+08:00

Data Type

Data Type

Input

Output

Numeric

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

Character

CHAR[(n)] / CHARACTER [(n)]

CHAR(n)

CLOB

CLOB

LONG VARCHAR

TEXT

VARCHAR(n) / CHAR VARYING(n) / CHARACTER VARYING(n)

VARCHAR(n)

Date/Time

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

Range

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

Binary

BLOB[(n)]

blob

BYTE[(n)]

bytea

VARBYTE[(n)]

bytea

BYTEINT

Input

SELECT cast(col as byteint) FROM tab;

Output

SELECT CAST( col AS SMALLINT ) FROM tab ;