Other related articles:

Recently viewed articles:

SQL ASCII Function

SQL ASCII function is used to return the ASCII (American Standard Code for Information Interchange) representation of the leftmost character of a string. If string contains no characters, a NULL value is returned. An error will be returned when a value for the string argument is not specified. The syntax is

ASCII (CHARACTER SET)

Example 1:

The following SQL ASCII query returns 65, which is the ASCII code for capital “A”.

SELECT ASCII('A') FROM dual;

Output:

Example 2:

The following SQL ASCII query also returns 65, which is the ASCII code for “A”.

SELECT ASCII('ABC') FROM dual;

Output:

Example 3:

The following query returns 97, which is the ASCII code for small “a”.