Skip to main content

LENGTH

Description

Returns the number of bytes in a string.

Syntax

LENGTH ( <str> )

Parameters

ParameterDescription
<str>The string whose bytes need to be calculated

Return Value

The number of bytes in the string <str>.

Example

SELECT LENGTH("abc"),length("中国")
+---------------+------------------+
| length('abc') | length('中国') |
+---------------+------------------+
| 3 | 6 |
+---------------+------------------+