Skip to content
Related Articles

Related Articles

Improve Article

PLSQL | COMPOSE Function

  • Last Updated : 19 Sep, 2019

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 Compose Function in PLSQL is used to return a Unicode string.

The unistring values that can be combined with other characters in the compose function are:

  1. unistr(‘\0300’) – grave accent ( ` )
  2. unistr(‘\0301’) – acute accent ( ´ )
  3. unistr(‘\0302’) – circumflex ( ^ )
  4. unistr(‘\0303’) – tilde ( ~ )
  5. unistr(‘\0308’) – umlaut ( ¨ )

Syntax:

COMPOSE( string )

Parameters Used:

string – It is used to specify the input value whose Unicode string needs to be created.



Supported Versions of Oracle/PLSQL:

  1. Oracle 12c
  2. Oracle 11g
  3. Oracle 10g
  4. Oracle 9i

Example:

DECLARE 
   Test_Char char := 'a';
   Test_Char2 char := 'e';
   
BEGIN 
   dbms_output.put_line(COMPOSE(Test_Char || unistr('\0308' ))); 
   dbms_output.put_line(COMPOSE(Test_Char || unistr('\0301' )));
   dbms_output.put_line(COMPOSE(Test_Char || unistr('\0303' ))); 
   dbms_output.put_line(COMPOSE(Test_Char2 || unistr('\0302' ))); 
   
END;  

Output:

ä
á
ã
ê

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 :