2 Ways to Convert to Uppercase in Oracle

Below are two functions that convert lowercase characters to their uppercase equivalent in Oracle Database.

Both functions work in a similar way, but with a minor difference.

The UPPER() Function

The UPPER() function returns its argument with all letters in uppercase.

Example:

SELECT UPPER('Blood Orgy of the She-Devils') 
FROM DUAL;

Result:

BLOOD ORGY OF THE SHE-DEVILS

Any uppercase letters remain in uppercase, while lowercase characters are converted to uppercase.

The NLS_UPPER() Function

The NLS_UPPER() function is similar to the UPPER() function, except that it accepts a second argument that allows you to specify the collation. The collation handles special linguistic requirements for case conversions. 

The second argument is optional, so we can use this function to do exactly the same as the previous example:

SELECT NLS_UPPER('Blood Orgy of the She-Devils') 
FROM DUAL;

Result:

BLOOD ORGY OF THE SHE-DEVILS

However, we can also call the function with a second argument to specify the collation.

Example:

SELECT 
    NLS_UPPER('fasilə') AS r1,
    NLS_UPPER('fasilə', 'NLS_SORT = XAZERBAIJANI') AS r2
FROM DUAL;

Result:

       R1        R2 
_________ _________ 
FASILƏ    FASİLƏ   

Notice that the second column uses a dotted uppercase I character, which adheres to the Azerbaijani writing system.