All pages
Powered by GitBook
1 of 1

Loading...

ORD

Return the numeric value of the first character. This function returns the code for the leftmost character, supporting multi-byte characters.

Syntax

ORD(str)

Description

If the leftmost character of the string str is a multi-byte character, returns the code for that character, calculated from the numeric values of its constituent bytes using this formula:

If the leftmost character is not a multi-byte character, ORD() returns the same value as the function.

Examples

See Also

  • - Return ASCII value of first character

  • - Create a character from an integer value

This page is licensed: GPLv2, originally from

ASCII()
ASCII()
CHAR()
fill_help_tables.sql
(1st byte code)
+ (2nd byte code x 256)
+ (3rd byte code x 256 x 256) ...
SELECT ORD('2');
+----------+
| ORD('2') |
+----------+
|       50 |
+----------+