Open In App

PLSQL | ASCIISTR Function

Last Updated : 08 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads