PLSQL | ASCIISTR 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 ASCIISTR Function in PLSQL is used for converting a string in any character set to an ASCII string using the database character set.
Syntax:
ASCIISTR( string )
Parameters Used: string – It is used to specify the character set that you want to convert to an ASCII string in the database character set.
Supported Versions of Oracle/PLSQL:
- Oracle 12c
- Oracle 11g
- Oracle 10g
- Oracle 9i
Example:
DECLARE
Test_Char char := 'E';
Test_Char2 varchar2(5) := 'Ê';
Test_Char3 char := 'H';
Test_String varchar2(20) := 'H Ê l l Õ';
BEGIN
dbms_output.put_line(ASCIISTR(Test_Char));
dbms_output.put_line(ASCIISTR(Test_Char2));
dbms_output.put_line(ASCIISTR(Test_Char3));
dbms_output.put_line(ASCIISTR(Test_String));
END;
Output:
E
\00CA
H
H \00CA l l \00D5