ASCII is one of the vital string/char functions of Oracle. It is used to return the ASCII code for the desired character or symbol. The ASCII function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.
Syntax:
ASCII( character )
Parameters:
character: It is used to specify the character, for which the ASCII code needs to be retrieved. It only accepts a single character and on typing more than one character it just ignores all the characters other than the first one.
Example 1:
ASCII('a') |
Output:
97
Explanation:
The ASCII code of ‘a’ is 97 and so is the result.
Example 2:
ASCII('AB') |
Output:
65
Explanation:
The ASCII code of ‘A’ is 65 and so is the result. The other character B is ignored by the ASCII function.