Computer >> Computer tutorials >  >> Programming >> MySQL

What is MySQL OCTET_LENGTH() function?


MySQL OCTET_LENGTH() function is used to count the number of characters in a string. Basically, it is a synonym of LENGTH() function. Its syntax is as follows −

Syntax

OCTET_LENGTH(Str)

Here, Str is a string whose length of characters has to be returned.

Example

mysql> Select OCTET_LENGTH('My name is Ram')As Str_Length;
+------------+
| Str_Length |
+------------+
|         14 |
+------------+
1 row in set (0.00 sec)