OCTET_LENGTH

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the number of bytes in a string.

Syntax 

1octet_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.

1SELECT octet_length('jose') AS result;

Returns 4 (4 ASCII characters, 1 byte each).

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!