Book Contents

Book Index

Next Topic

Home

OCTET_LENGTH

LENGTH returns an INTEGER value representing the true number of bytes in a string.

Syntax

LENGTH ( expression )

Semantics

 

expression

(CHAR or VARCHAR) is the string to measure

Notes

Examples

> SELECT OCTET_LENGTH('1234 '::CHAR(10));

octet_length

--------------

10

(1 row)

> SELECT OCTET_LENGTH('1234 '::VARCHAR(10));

octet_length

--------------

6

(1 row)

> SELECT OCTET_LENGTH(NULL::CHAR(10)) IS NULL;

?column?

----------

t

(1 row)