Skip to main content
Version: V1.0.0

ORD

Declaration

ORD(str)

Description

Returns the ASCII value of the leftmost character in a string. For single-byte encoding, if the leftmost character is a multibyte character, the return value is calculated as follows:

(1st byte code)
+ (2nd byte code * 256)
+ (3rd byte code * 256^2) ...

If the leftmost character is not a multibyte character, ORD() returns the same value as the ASCII() function.

Examples

SELECT ORD('China');
+---------------+
| ORD('China') |
+---------------+
| 14989485 |
+---------------+
1 row in set (0.001 sec)