Purpose
ASCII() returns the ASCII code value of the leftmost character in a character expression.
Syntax
ASCII(char)
Parameters
| Parameter | Description |
|---|---|
| char | An expression of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type. |
Return type
The return type is NUMBER.
Examples
The following example uses the ASCII function to return the ASCII code values of the letters A and a and a space.
obclient> SELECT ASCII('A') A, ASCII('a') a, ASCII(' ') space FROM DUAL;
+------+------+-------+
| A | A | SPACE |
+------+------+-------+
| 65 | 97 | 32 |
+------+------+-------+
1 row in set