Chinaunix

标题: !关于decimal数据类型的问题??请指教! [打印本页]

作者: sxf2000    时间: 2003-05-09 09:48
标题: !关于decimal数据类型的问题??请指教!
在安装的DB2中,怎么没找到decmail.h头文件?
如何定义DECIMAI类型的宿主变量?
作者: Law    时间: 2003-05-12 09:51
标题: !关于decimal数据类型的问题??请指教!
不用定义,他和c有对应的数据类型
SQL Column Type(TNTA1)  C/C++ Data Type  SQL Column Type Description  

SMALLINT
(500 or 501)


short
short int
sqlint16

16-bit signed integer  

INTEGER
(496 or 497)


long
long int
sqlint32(TNTA1A)

32-bit signed integer  

BIGINT
(492 or 493)


long long
long
__int64
sqlint64(TNTA1B)

64-bit signed integer  

REAL(TNTA2)
(480 or 481)

float  Single-precision floating point  

DOUBLE(TNTA3)
(480 or 481)

double  Double-precision floating point  

DECIMAL(p,s)
(484 or 485)

No exact equivalent; use double  Packed decimal
(Consider using the CHAR and DECIMAL functions to manipulate packed decimal fields as character data.)


CHAR(1)
(452 or 453)

char  Single character  

CHAR(n)
(452 or 453)

No exact equivalent; use char[n+1] where n is large enough to hold the data
1<=n<=254
Fixed-length character string  

VARCHAR(n)
(448 or 449)


struct tag {
short int;
char[n]
}
  
1<=n<=32 672

Non null-terminated varying character string with 2-byte string length indicator  
Alternately use char[n+1] where n is large enough to hold the data
1<=n<=32 672
null-terminated variable-length character string Note: Assigned an SQL type of 460/461.  


LONG VARCHAR
(456 or 457)


struct tag {
short int;
char[n]
}
  
32 673<=n<=32 700

Non null-terminated varying character string with 2-byte string length indicator  

CLOB(n)
(408 or 409)


sql type is
clob(n)
  
1<=n<=2 147 483 647

Non null-terminated varying character string with 4-byte string length indicator  

CLOB locator variable(TNTA4)
(964 or 965)


sql type is
clob_locator

Identifies CLOB entities residing on the server  

CLOB file reference variable(TNTA4)
(920 or 921)


sql type is
clob_file

Descriptor for file containing CLOB data  

BLOB(n)
(404 or 405)


sql type is
blob(n)
  
1<=n<=2 147 483 647

Non null-terminated varying binary string with 4-byte string length indicator  

BLOB locator variable(TNTA4)
(960 or 961)


sql type is
blob_locator

Identifies BLOB entities on the server  

BLOB file reference variable(TNTA4)
(916 or 917)


sql type is
blob_file

Descriptor for the file containing BLOB data  

DATE
(384 or 385)

null-terminated character form  Allow at least 11 characters to accommodate the null-terminator.  
VARCHAR structured form  Allow at least 10 characters.  

TIME
(388 or 389)

null-terminated character form  Allow at least 9 characters to accommodate the null-terminator.  
VARCHAR structured form  Allow at least 8 characters.  

TIMESTAMP
(392 or 393)

null-terminated character form  Allow at least 27 characters to accommodate the null-terminator.  
VARCHAR structured form  Allow at least 26 characters.  
Note: The following data types are only available in the DBCS or EUC environment when precompiled with the WCHARTYPE NOCONVERT option.  


GRAPHIC(1)
(468 or 469)

sqldbchar  Single double-byte character  

GRAPHIC(n)
(468 or 469)

No exact equivalent; use sqldbchar[n+1] where n is large enough to hold the data
1<=n<=127
Fixed-length double-byte character string  

VARGRAPHIC(n)
(464 or 465)


struct tag {
short int;
sqldbchar[n]
}
  
1<=n<=16 336

Non null-terminated varying double-byte character string with 2-byte string length indicator  
Alternately use sqldbchar[n+1] where n is large enough to hold the data
1<=n<=16 336
null-terminated variable-length double-byte character string Note: Assigned an SQL type of 400/401.  


LONG VARGRAPHIC
(472 or 473)


struct tag {
short int;
sqldbchar[n]
}
  
16 337<=n<=16 350

Non null-terminated varying double-byte character string with 2-byte string length indicator  
Note: The following data types are only available in the DBCS or EUC environment when precompiled with the WCHARTYPE CONVERT option.  


GRAPHIC(1)
(468 or 469)

wchar_t  Single wide character (for C-type)
Single double-byte character (for column type)



GRAPHIC(n)
(468 or 469)

No exact equivalent; use wchar_t [n+1] where n is large enough to hold the data
1<=n<=127
Fixed-length double-byte character string  

VARGRAPHIC(n)
(464 or 465)


struct tag {
short int;
wchar_t [n]
}

1<=n<=16 336

Non null-terminated varying double-byte character string with 2-byte string length indicator  
Alternately use char[n+1] where n is large enough to hold the data
1<=n<=16 336
null-terminated variable-length double-byte character string Note: Assigned an SQL type of 400/401.  


LONG VARGRAPHIC
(472 or 473)


struct tag {
short int;
wchar_t [n]
}
  
16 337<=n<=16 350

Non null-terminated varying double-byte character string with 2-byte string length indicator  
Note: The following data types are only available in the DBCS or EUC environment.  


DBCLOB(n)
(412 or 413)


sql type is
dbclob(n)
  
1<=n<=1 073 741 823

Non null-terminated varying double-byte character string with 4-byte string length indicator  

DBCLOB locator variable(TNTA4)
(968 or 969)


sql type is
dbclob_locator

Identifies DBCLOB entities residing on the server  

DBCLOB file reference
variable(TNTA4)
(924 or 925)


sql type is
dbclob_file

Descriptor for file containing DBCLOB data


我没有排版,你自己排吧,,

你可以在信息中心里面搜索到,,
关键字:
Supported SQL Data Types in C and C++




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2