本章枚举并说明SQL ISO规范中给定的数据类型,并列出JDBC规范及Oracle、SQLServer对应的数据类型。

大类ISO/ANSIJDBCOracleSQLServerMySQLPostgreSQL
文本CHARACTER(n)CHARCHARchar  
CHARACTER VARYING(n)VARCHARVARCHAR
(VARCHAR2)
varchar  
CHARACTER LARGE OBJECTCLOBCLOBtext  
NATIONAL CHARACTER(n)NCHARNCHARnchar  
NATIONAL CHARACTER VARYING(n)NVARCHARNVARCHAR
(NVARCHAR2)
nvarchar  
NATIONAL CHARACTER LARGE OBJECTNCLOBNCLOBntext  
字节BINARY(n)BINARY×binary  
BINARY VARYING(n)VARBINARY×varbinary  
BINARY LARGE OBJECTBLOBBLOBimage  
整形SMALLINTSMALLINTNUMBER(5)smallint  
INTEGERINTEGERNUMBER(10)int  
BIGINTBIGINTNUMBER(38)bigint  
数值DECIMALDECIMALDECIMAL
(NUMBER)
decimal  
NUMERICNUMERICNUMERIC
(NUMBER)
numeric  
REALREALREALreal  
FLOATFLOATFLOAT
BINARY_FLOAT
float  
DOUBLE PRECISIONDOUBLEDOUBLE
BINARY_DOUBLE
   
DECFLOAT×××  
布尔BOOLEANBOOLEAN×bit  
日期DATEDATEDATEdate  
TIME WITHOUT TIME ZONETIMEDATEtime  
TIME WITH TIME ZONETIME_WITH_TIMEZONEDATEtime  
TIMESTAMP WITHOUT TIME ZONETIMESTAMPTIMESTAMPtimestamp  
TIMESTAMP WITH TIME ZONETIMESTAMP_WITH_TIMEZONETIMESTAMPtimestamp  
INTERVAL×    

其中Oracle数据类型,参见https://my.oschina.net/jixiaolei/blog/4816208