IBM Books

Call Level Interface Guide and Reference

Precision

The precision of a numeric column or parameter refers to the maximum number of digits used by the data type of the column or parameter. The precision of a non-numeric column or parameter generally refers to the maximum length or the defined length of the column or parameter. The following table defines the precision for each SQL data type.

Table 197. Precision
fSqlType Precision
SQL_CHAR 
SQL_VARCHAR
SQL_CLOB

The defined length of the column or parameter. For example, the precision of a column defined as CHAR(10) is 10.
SQL_LONGVARCHAR The maximum length of the column or parameter. a
SQL_DECIMAL 
SQL_NUMERIC

The defined maximum number of digits. For example, the precision of a column defined as NUMERIC(10,3) is 10.
SQL_SMALLINT b 5
SQL_INTEGER b 10
SQL_FLOAT b 15
SQL_REAL 
b

7 

SQL_DOUBLE 
b

15 

SQL_BINARY 
SQL_VARBINARY
SQL_BLOB

The defined length of the column or parameter. For example, the precision of a column defined as CHAR(10) FOR BIT DATA, is 10.
SQL_LONGVARBINARY 

The maximum length of the column or parameter.
SQL_DATE 
b

10 (the number of characters in the yyyy-mm-dd format).
SQL_TIME b 8 (the number of characters in the hh:mm:ss format).
SQL_TIMESTAMP 

The number of characters in the "yyy-mm-dd hh:mm:ss[.fff[fff]]" format used by the TIMESTAMP data type. For example, if a timestamp does not use seconds or fractional seconds, the precision is 16 (the number of characters in the "yyyy-mm-dd hh:mm" format). If a timestamp uses thousandths of a second, the precision is 23 (the number of characters in the "yyyy-mm-dd hh:mm:ss.fff" format).
SQL_GRAPHIC 
SQL_VARGRAPHIC
SQL_DBCLOB

The defined length of the column or parameter. For example, the precision of a column defined as GRAPHIC(10) is 10.
SQL_LONGVARGRAPHIC The maximum length of the column or parameter.
Note:
a
When defining the precision of a parameter of this data type with SQLBindParameter() or SQLSetParam(), cbParamDef should be set to the total length of the data, not the precision as defined in this table.
b
The cbParamDef argument of SQLBindParameter() or SQLSetParam() is ignored for this data type.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]