The LENGTH() function

Use the LENGTH() SQL function to determine if the string is from a binaryvar or a binary18 column. The LENGTH() function returns the number of bytes in a column.

Syntax

LENGTH(column)
column
The binary data type column.

Usage

This function returns the length of the column in bytes as an integer. For the binary18 data type, the function always returns 18.

For binary data types, the SQL LENGTH() and OCTET_LENGTH() functions return the same value. For more information about length functions, see the Informix® Guide to SQL: Reference.

Example

SELECT length(binaryvar_col) FROM table WHERE binaryvar_col = '0A010204'
expression
------------------
 4