OCTET_LENGTH()

Documentation

Home » Documentation » Using VoltDB

OCTET_LENGTH()

OCTET_LENGTH() — Returns the number of bytes in a string.

Synopsis

OCTET_LENGTH( string-expression )

Description

The OCTET_LENGTH() function returns the number of bytes of data in a string.

Note that the number of bytes required to store a string and the actual characters that make up the string can differ. To count the number of characters in the string use the CHAR_LENGTH() function.

Example

The following example returns the string in the column LastName as well as the number of characters and length in bytes of that string.

SELECT LastName, CHAR_LENGTH(LastName), OCTET_LENGTH(LastName)
    FROM Customers ORDER BY LastName, FirstName;