Scale of SQL data types

The scale of a numeric column or parameter refers to the maximum number of digits to the right of the decimal point. For approximate floating-point number columns or parameters, the scale is undefined because the number of digits to the right of the decimal place is not fixed.

The following table defines the scale for each SQL data type

Table 1. Scale of SQL data types
fSqlType Scale
  • SQL_CHAR
  • SQL_VARCHAR
  • SQL_LONGVARCHAR
  • SQL_CLOB
Not applicable.
  • SQL_DECIMAL
  • SQL_NUMERIC
The defined number of digits to the right of the decimal place. For example, the scale of a column defined as NUMERIC(10,3) is 3.
  • SQL_SMALLINT
  • SQL_INTEGER
  • SQL_BIGINT
0
SQL_DECFLOAT Not applicable.
  • SQL_REAL
  • SQL_FLOAT
  • SQL_DOUBLE
Not applicable.
SQL_ROWID Not applicable.
  • SQL_BINARY
  • SQL_VARBINARY
  • SQL_LONGVARBINARY
  • SQL_BLOB
Not applicable.
  • SQL_TYPE_DATE
  • SQL_TYPE_TIME
Not applicable.
SQL_TYPE_TIMESTAMP The number of digits to the right of the decimal point in the #yyyy-mm-dd hh:mm:ss[ffffffffffff]” format. For example, if the TIMESTAMP data type uses the "yyyy-mm-dd hh:mm:ss.fff” format, the scale is 3. The maximum for fractional seconds is 12 digits. You can retrieve the scale through the pibScale argument of SQLDescribeCol().
SQL_TYPE_TIMESTAMP_WITH_TIMEZONE The number of fractional digits to the right of the decimal point in the "yyyy-mm-dd hh:mm:ss.ff+hh:mm" or "yyyy-mm-dd-hh.mm.ss.ff+hh:mm" format. For example, if the TIMESTAMP WITH TIME ZONE data type uses the "yyyy-mm-dd hh:mm:ss.ff+hh:mm" format, the scale is 2. The maximum for fractional seconds is 12 digits. You can retrieve the scale through the pibScale argument of SQLDescribeCol().
  • SQL_GRAPHIC
  • SQL_VARGRAPHIC
  • SQL_LONGVARGRAPHIC
  • SQL_DBCLOB
Not applicable.
SQL_XML 0