PLSQL | ASCII Function
The string in PL/SQL is actually a sequence of characters with an optional size specification.
The characters could be numeric, letters, blank, special characters or a combination of all.
The ASCII Function in PLSQL is used to return the NUMBER code that represents the specified character.
Syntax
ASCII( single_character )
Parameters Used:
single_character – It is used to retrieve the NUMBER code for the specified character.
If more than one character is entered, the ASCII function will return the value for the first character and ignore all of the characters after the first.
Supported Versions of Oracle/PLSQL:
- Oracle 12c
- Oracle 11g
- Oracle 10g
- Oracle 9i
- Oracle 8i
Example:
DECLARE
Test_Char char := 'A';
Test_Char2 char := 'H';
Test_String varchar2(6) := 'Hello';
BEGIN
dbms_output.put_line(ASCII(Test_Char));
dbms_output.put_line(ASCII(Test_Char2));
dbms_output.put_line(ASCII(Test_String));
END;
Output:
65 72 72
Recommended Posts:
- PLSQL | ABS Function
- PLSQL | CHR Function
- PLSQL | LEAST Function
- PLSQL | DUMP Function
- PLSQL | DECOMPOSE Function
- PLSQL | ATAN Function
- PLSQL | LENGTHB Function
- PLSQL | LENGTHC Function
- PLSQL | INITCAP Function
- PLSQL | CONVERT Function
- PLSQL | ASIN Function
- PLSQL | INSTR Function
- PLSQL | ACOS Function
- PLSQL | VSIZE Function
- PLSQL | ASCIISTR Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



