Open In App

PLSQL | UPPER Function

Last Updated : 11 Oct, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The PLSQL UPPER function is used for converting all letters in the specified string to uppercase. If there are characters in the string that are not letters, they are unaffected by this function.

The char to be converted can be any of the datatypes such as CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The value returned by the UPPER function is the same datatype as char. The database sets the case of the characters based on the binary mapping defined for the underlying character set.

Syntax:

UPPER( string )

Parameters Used:

string – It is used to specify the string which needs to be converted.

Return Value:
The UPPER function in PLSQL returns a string value.

Supported Versions of Oracle/PLSQL

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

Example-1: Passing a string as an argument with first character in uppercase and rest of the characters in lowercase.

DECLARE 
   Test_String string(20) := 'Geeksforgeeks';
   
BEGIN 
   dbms_output.put_line(UPPER(Test_String)); 
   
END;  

Output:

GEEKSFORGEEKS 

Example-2: Passing a string as an argument with all the characters in lowercase.

DECLARE 
   Test_String string(20) := 'geeksforgeeks';
   
BEGIN 
   dbms_output.put_line(UPPER(Test_String)); 
   
END;   

Output:

GEEKSFORGEEKS 

Example-3: Passing a string as an argument with numeric values and characters in lowercase.

DECLARE 
   Test_String string(20) := '123geeksforgeeks123';
   
BEGIN 
   dbms_output.put_line(UPPER(Test_String)); 
   
END; 

Output:

123GEEKSFORGEEKS123 

Advantage:
The UPPER function accepts any of the datatypes CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB in the input_string.


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

Similar Reads