All Products
Search
Document Center

ASCII

Last Updated: Jun 18, 2021

The ASCII function returns the ASCII code value of the leftmost character of a character expression.

Syntax

ASCII(x)

Parameters

Parameter

Description

x

The expression of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type.

Return type

NUMBER data type

Examples

In this example, the ASCII function returns the ASCII code values of A, a, Medium, and spaces.

SELECT ASCII('A') A, ASCII('a') a, ASCII(' ') space,ASCII('Medium') hz FROM DUAL;

The following result is returned:

+----+----+-------+-----+
| A  | a  | space |  hz |
+----+----+-------+-----+
| 65 | 97 |    32 | 228 |
+----+----+-------+-----+