ID EN
String Functions and Operators

ORD(str)

MySQL 8.4 🇮🇩 Bahasa Indonesia

Jika karakter paling kiri dari string str adalah karakter multibyte, mengembalikan kode untuk karakter tersebut, dihitung dari nilai numerik byte penyusunnya menggunakan rumus ini:

Syntax

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

Contoh

Example

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

MYSQL
(1st byte code)
+ (2nd byte code * 256)
+ (3rd byte code * 256^2) ...
Example 2
MYSQL
SELECT ORD('2');
50