solidDB Help : solidDB reference : ODBC: Data types : Decimal digits
  
Decimal digits
Decimal digits apply to decimal and numeric data types. They refer to the maximum number of digits to the right of the decimal point, or the scale of the data.
Because the number of digits to the right of the decimal point is not fixed, the scale is undefined for approximate floating-point number columns or parameters. When datetime data contains a seconds component, the decimal digits are the number of digits to the right of the decimal point in the seconds component of the data.
Typically, the maximum scale matches the maximum precision for SQL_DECIMAL and SQL_NUMERIC data types. Some data sources, however, have their own maximum scale limit. An application can call SQLGetTypeInfo to determine the minimum and maximum scales allowed for a data type.
The following table describes the ODBC functions that return parameter decimal attributes in an SQL statement data type or decimal attributes on a data source:
 
ODBC function
Returns...
SQLDescribeCol
Decimal digits of the columns it describes.
SQLDescribeParam
Decimal digits of the parameters it describes.
SQLProcedureColumns
Decimal digits in a column of a procedure.
SQLColumns
Decimal digits in specified tables (such as the base table, view, or a system table).
SQLColAttribute
Decimal digits of columns at the data source.
SQLGetTypeInfo
Minimum and maximum decimal digits of an SQL data type on a data source.
The SQLBindParameter sets the decimal digits for a parameter in an SQL statement.
The values returned by ODBC functions for decimal digits correspond to "scale" as defined in ODBC 2.x.
Descriptor fields describe the characteristics of a result set. They do not contain valid data values before statement execution. However, the decimal digits values returned by SQLColumns, SQLProcedureColumns, and SQLGetTypeInfo, do represent the characteristics of database objects, such as table columns and data types form the data source catalog.
Each concise SQL data type has the following decimal digits definition as noted in the following table:
 
SQL type identifier
Decimal digits
All character and binary types (1)
N/A
SQL_DECIMAL SQL_NUMERIC
The defined number of digits to the right of the decimal point. For example, the scale of a column defined as NUMERIC(10,3) is 3. (In some implementations, this can be a negative number to support storage of very large numbers without using exponential notation; for example, "12000" could be stored as "12" with a scale of -3. However, solidDB does not support negative scale.)
All exact numeric types other than SQL_DECIMAL and SQL_NUMERIC (1)
0
All approximate data types (1)
N/A
1 The DecimalDigits argument for SQLBindParameter is ignored for this data type.
For decimal digits, the values returned do not correspond to the values in any one descriptor field. The values returned (for example, in SQLColAttribute) for the decimal digits can come from either the SQL_DESC_SCALE or the SQL_DESC_PRECISION field, depending on the data type, as shown in the following table:
 
SQL type identifier
Descriptor field corresponding to decimal digits
All character and binary types
N/A
All exact numeric types
SCALE
All approximate numeric types
N/A
All datetime types
PRECISION
Go up to
ODBC: Data types