SQL-J Language Reference
Page 78 of 121

OCTET_LENGTH

OCTET_LENGTH returns the number of octets in a character string expression or a bit string expression. For a bit string, the number of octets and the number of characters are always the same, since a bit string is considered to be made up of a series of octets.

Syntax

OCTET_LENGTH ( CharacterExpression | BitExpression )

A CharacterExpression is a CHAR, VARCHAR, or LONG VARCHAR data type, any built-in type that is implicitly converted to a string (except a bit expression), or any Java data type that directly maps to a built-in type that is implicitly converted to a string.

OCTET_LENGTH Examples

-- returns 20
VALUES OCTET_LENGTH('supercalifragilistic')

-- returns 1
VALUES OCTET_LENGTH(X'FF')