webCOMAND

ORD()

Return character code for leftmost character of the argument

Prototype

mixed ORD(string str)

Parameter

  • str - Expression that should evaluate to a integer or decimal number.

Return

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

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

If the leftmost character is not a multibyte character, returns the value of the character byte. The function returns NULL if str is NULL.

Example

SELECT OID, Name, ORD(Name) AS FirstLetterValue FROM Contact

Related

ORD() in MySQL Docs