UPPER() Function in Oracle

In Oracle, the UPPER() function returns its argument with all letters in uppercase.

Syntax

The syntax goes like this:

UPPER(char)

Where char can be of any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB

Example

Here’s a simple example to demonstrate:

SELECT UPPER('speak louder please')
FROM DUAL;

Result:

   UPPER('SPEAKLOUDERPLEASE') 
_____________________________ 
SPEAK LOUDER PLEASE          

The same applies when the argument uses mixed case:

SELECT UPPER('Speak Louder Please')
FROM DUAL;

Result:

   UPPER('SPEAKLOUDERPLEASE') 
_____________________________ 
SPEAK LOUDER PLEASE          

And if the argument is already uppercase, then the result is the same as the input:

SELECT UPPER('SPEAK LOUDER PLEASE')
FROM DUAL;

Result:

   UPPER('SPEAKLOUDERPLEASE') 
_____________________________ 
SPEAK LOUDER PLEASE          

Null Values

Passing null returns null:

SET NULL 'null';

SELECT UPPER(null)
FROM DUAL;

Result:

   UPPER(NULL) 
______________ 
null          

By default, SQLcl and SQL*Plus return a blank space whenever null occurs as a result of a SQL SELECT statement.

However, you can use SET NULL to specify a different string to be returned. Here I specified that the string null should be returned.

Incorrect Argument Count

Calling UPPER() without passing any arguments returns an error:

SELECT UPPER()
FROM DUAL;

Result:

Error starting at line : 1 in command -
SELECT UPPER()
FROM DUAL
Error at Command Line : 1 Column : 8
Error report -
SQL Error: ORA-00909: invalid number of arguments
00909. 00000 -  "invalid number of arguments"
*Cause:    
*Action:

And passing the wrong number of arguments results in an error:

SELECT UPPER('Speak', 'Louder')
FROM DUAL;

Result:

Error starting at line : 1 in command -
SELECT UPPER('Speak', 'Louder')
FROM DUAL
Error at Command Line : 1 Column : 8
Error report -
SQL Error: ORA-00909: invalid number of arguments
00909. 00000 -  "invalid number of arguments"
*Cause:    
*Action: