Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Returns the number of bytes in a string.
Syntax
octet_length(<string>)
Arguments
Required
<string>: The string to measure.
Returns
Returns an integer that represents the number of bytes in the string.
Considerations
- For UTF-8 encoded strings, multi-byte characters contribute more than one byte each.
- This function differs from
char_length, which counts characters.
Examples
Calculate Byte Length
Get the byte length of a string.
SELECT octet_length('jose') AS result;
Returns 4 (4 ASCII characters, 1 byte each).