ASCII function

This function gives the ASCII value of the first character of a string. The general format for this function is:

ASCII(string)

SQL> SELECT ASCII('abc') FROM dual;

ASCII('ABC')
------------
          97

SQL>

ASCII(x) gets the ASCII value for the character x. The following query gets the ASCII value of a, A, 0, and 9 using ASCII():


SQL> SELECT ASCII('a'), ASCII('A'), ASCII(0), ASCII(9) FROM dual;

ASCII('A') ASCII('A')   ASCII(0)   ASCII(9)
---------- ---------- ---------- ----------
        97         65         48         57

SQL>
Home »
Oracle »
String Functions » 

Related: