Skip to content
Related Articles

Related Articles

Improve Article

PLSQL | ASCIISTR Function

  • Last Updated : 19 Sep, 2019
Geek Week

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:



  1. Oracle 12c
  2. Oracle 11g
  3. Oracle 10g
  4. 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 

Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course  by GeeksforGeeks.

My Personal Notes arrow_drop_up
Recommended Articles
Page :