D/MySQL
[MySQL] ORD()
yeon.Biju
2020. 4. 14. 14:51
MySQL 문자열 함수와 연산지
ORD()
-
ORD(str)
의 형태
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 bye 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.
mysql> SELECT ORD('한글') ;
+---------------+
| ORD('한글') |
+---------------+
| 15570332 |
+---------------+
1 row in set (0.00 sec)
mysql> SELECT ORD(2) ;
+--------+
| ORD(2) |
+--------+
| 50 |
+--------+
1 row in set (0.00 sec)