Home | Previous Page | Next Page   Data Types > SQL Data Types >

Precision, Scale, Length, and Display Size

The functions that get and set precision, scale, length, and display size for SQL values have size limitations for their input arguments. Therefore, these values are limited to the size of an SDWORD that has a maximum value of 2,147,483,647. The following table describes these values.

Value Description for a Numeric Data Type Description for a Non-Numeric Data Type
Precision Maximum number of digits. Either the maximum length or the specified length.
Scale Maximum number of digits to the right of the decimal point. For floating point values, the scale is undefined because the number of digits to the right of the decimal point is not fixed. Not applicable.
Length Maximum number of bytes that a function returns when a value is transferred to its default C data type. Maximum number of bytes that a function returns when a value is transferred to its default C data type. The length does not include the NULL termination byte.
Display size Maximum number of bytes needed to display data in character form. Maximum number of bytes needed to display data in character form.

Standard SQL Data Types

The following table describes the precision, scale, length, and display size for the standard Informix ODBC Driver SQL data types.

Informix ODBC Driver SQL Data Type (fSqlType) Description
SQL_BIGINT
(IDS)
Precision: 19. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: 0. SQLBindParameter ignores the value of ibScale for this data type.

Length: 8 bytes.

Display size: 20 digits. One digit is for the sign.

SQL_BIT
(IDS)

Precision: 1. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: 0. SQLBindParameter ignores the value of ibScale for this data type.

Length: 1 byte.

Display size: 1 digit.

SQL_CHAR

Precision: Same as the length.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: The specified length. For example, the length of CHAR(10) is 10 bytes.

Display size: Same as the length.

SQL_DATE

Precision: 10. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: 6 bytes.

Display size: 10 digits in the format yyyy-mm-dd.

SQL_DECIMAL

Precision: The specified precision. For example, the precision of DECIMAL (12, 3) is 12.

Scale: The specified scale. For example, the scale of DECIMAL(12, 3) is 3.

Length: The specified precision plus 2. For example, the length of DECIMAL(12, 3) is 14 bytes. The two additional bytes are used for the sign and the decimal points because functions return this data type as a character string.

Display size: Same as the length.

SQL_DOUBLE

Precision: 15. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: 8 bytes.

Display size: 22 digits. The digits are for a sign, 15 numeric characters, a decimal point, the letter E, another sign, and 2 more numeric characters.

SQL_INTEGER

Precision: 10. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: 0. SQLBindParameter ignores the value of ibScale for this data type.

Length: 4 bytes.

Display size: 11 digits. One digit is for the sign.

SQL_LONGVARBINARY

Precision: Same as the length.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: The maximum length. If a function cannot determine the maximum length, it returns SQL_NO_TOTAL.

Display size: The maximum length times 2. If a function cannot determine the maximum length, it returns SQL_NO_TOTAL.

SQL_LONGVARCHAR

Precision: Same as the length.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: The maximum length. If a function cannot determine the maximum length, it returns SQL_NO_TOTAL.

Display size: Same as the length.

SQL_REAL

Precision: 7. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: 4 bytes.

Display size: 13 digits. The digits are for a sign, 7 numeric characters, a decimal point, the letter E, another sign, and 2 more numeric characters.

SQL_SMALLINT

Precision: 5. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: 0. SQLBindParameter ignores the value of ibScale for this data type.

Length: 2 bytes.

Display size: 6 digits. One digit is for the sign.

SQL_TIMESTAMP

Precision: 8. SQLBindParameter ignores the value of cbColDef for this data type.

Scale: The number of digits in the FRACTION field.

Length: 16 bytes.

Display size: 19 or more digits:

  • If the scale of the time stamp is 0: 19 digits in the format yyyy-mm-dd hh:mm:ss.
  • If the scale of the time stamp exceeds 0: 20 digits plus digits for the FRACTION field in the format yyyy-mm-dd hh:mm:ss.f...
SQL_VARCHAR

Precision: Same as the length.

Scale: Not applicable. SQLBindParameter ignores the value of ibScale for this data type.

Length: The specified length. For example, the length of VARCHAR(10) is 10 bytes.

Display size: Same as the length.

Additional SQL Data Types for Dynamic Server

The following table describes the precision, scale, length, and display size for the Informix ODBC Driver SQL data types for Dynamic Server.

Informix ODBC Driver SQL Data Type (fSqlType) Description
SQL_IFMX_UDT_BLOB

Precision: Variable value. To determine this value, call a function that returns the precision for a column.

Scale: Not applicable. A function that returns the scale for a column returns -1 for this data type.

Length: Variable value. To determine this value, call a function that returns the length for a column.

Display Size: Variable value. To determine this value, call a function that returns the display size for a column.

SQL_IFMX_UDT_CLOB

Precision: Variable value. To determine this value, call a function that returns the precision for a column.

Scale: Not applicable. A function that returns the scale for a column returns -1 for this data type.

Length: Variable value. To determine this value, call a function that returns the length for a column.

Display Size: Variable value. To determine this value, call a function that returns the display size for a column.

SQL_INFX_UDT_FIXED

Precision: Variable value. To determine this value, call a function that returns the precision for a column.

Scale: Not applicable. A function that returns the scale for a column returns -1 for this data type.

Length: Variable value. To determine this value, call a function that returns the length for a column.

Display Size: Variable value. To determine this value, call a function that returns the display size for a column.

SQL_INFX_UDT_VARYING

Precision: Variable value. To determine this value, call a function that returns the precision for a column.

Scale: Not applicable. A function that returns the scale for a column returns -1 for this data type.

Length: Variable value. To determine this value, call a function that returns the length for a column.

Display Size: Variable value. To determine this value, call a function that returns the display size for a column.

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