Data type precision (CLI) table
The precision of a numeric column or parameter refers to the maximum number of digits that are used by the data type of the column or parameter. The precision of a nonnumeric column or parameter generally refers to the maximum or defined number of characters of the column or parameter.
The following table defines the precision for each SQL data type.
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_DECFLOAT SQL_NUMERIC |
The defined maximum number of digits. For example, the precision of a column defined as NUMERIC(10,3) is 10 and the precision of a column defined as DECFLOAT(34) is 34. |
SQL_SMALLINT b | 5 |
SQL_BIGINT | 19 |
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_TYPE_DATE b
|
10 (the number of characters in the yyyy-mm-dd format). |
SQL_TYPE_TIME b | 8 (the number of characters in the hh:mm:ss format). |
SQL_TYPE_TIMESTAMP
|
The number of characters in the "yyyy-mm-dd hh:mm:ss[.ffffffffffff]" 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_TYPE_TIMESTAMP_ WITH_TIMEZONE | The number of characters in the "yyyy-mm-dd hh:mm:ss[.ffffffffffff]" format used by the TIMESTAMP_WITH_TIMEZONE data type. The valid range for the time zone is -12:59~ +14:00. If the timezone_hour is negative, the timezone_minute must be negative or zero. If the timezone_hour is positive, the timezone_minute must be positive or zero. If the timezone_hour is zero, the timezone_minute can have any value in the range -59 through +59. |
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. |
SQL_WCHAR
SQL_WVARCHAR SQL_WLONGVARCHAR |
The defined length of the column or parameter. For example, the precision of a column defined as WCHAR(10) is 10. |
SQL_XML | 0, unless the XML value is an argument to external routines. For external routines, the precision is the defined length, n, of an XML AS CLOB(n) argument. |
Note:
|