Oracle NLS_UPPER() Function

Oracle NLS_UPPER() is a built-in function that returns the uppercase form of a given string.

Relative to UPPER(), NLS_UPPER() allows you to specify the collation to use when converting.

If you need to convert a string to lowercase, use the LOWER() or NLS_LOWER() function.

Oracle NLS_UPPER() syntax

Here is the syntax for the Oracle NLS_UPPER() function:

NLS_UPPER(str)

Parameters

str

Required. It can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

'nlsparam'

Optional. You can set this parameter using the form 'NLS_SORT = sort', where sort is the name of the collation. Collations handle language-specific requirements for case conversion. If you omit this parameter, the collation is determined by the function.

Return Value

The Oracle NLS_UPPER() function returns the uppercase form of the given string.

If any parameter is NULL, NLS_UPPER() will return NULL.

Oracle NLS_UPPER() Examples

Here are some examples that demonstrate the usage of the Oracle NLS_UPPER() function.

Basic Usage

To convert Hello World to uppercase, use the following statement:

SELECT
    NLS_UPPER('Hello World') Result
FROM dual;

Output:

RESULT
______________
HELLO WORLD

Collation

Oracle NLS_UPPER() function allows you to specify collations to handle language-specific rules.

SELECT
    NLS_UPPER('große') "Result1",
    NLS_UPPER('große', 'NLS_SORT = XGerman') "Result2"
FROM dual;

Output:

Result1    Result2
__________ __________
GROßE      GROSSE

In this example, the uppercase form of ß is SS.

NULL Parameters

If any parameter is NULL, NLS_UPPER() will return NULL.

SET NULL 'NULL';
SELECT
    NLS_UPPER(NULL)
FROM dual;

Output:

NLS_UPPER(NULL)
__________________
NULL

In this example, we use the statement SET NULL 'NULL'; to display NULL values as the string 'NULL'.

Conclusion

Oracle NLS_UPPER() is a built-in function that returns the uppercase form of a given string.