Jump to: navigation, search

PostgreSQL OCTET LENGTH

From w3cyberlearnings

Contents

Postgresql octet_length

Returns a number of bytes in string.

Syntax octet_length

octet_length()

Example 1

test2=# SELECT octet_length('a');
 octet_length 
--------------
            1
(1 row)

test2=# SELECT octet_length('apple');
 octet_length 
--------------
            5
(1 row)

Example 2

test2=# SELECT user_firstname,
test2-# octet_length(user_firstname)
test2-# FROM profile;
 user_firstname | octet_length 
----------------+--------------
 Jim            |            3
 king           |            4
 Jammi          |            5
 Bob            |            3
                |             
(5 rows)

Related Links


Navigation
Web
SQL
MISC
References