Oracle NLS_LOWER() Function

Oracle NLS_LOWER() is a built-in function that returns the lowercase version of a given string.

Relative to Lower(), NLS_LOWER() allows you to specify the collation to use when converting.

If you need to convert a string to uppercase, use the UPPER() or NLS_UPPER() function.

Oracle NLS_LOWER() syntax

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

NLS_LOWER(str [, 'nlsparam' ])

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_LOWER() function returns the lowercase version of the given string.

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

Oracle NLS_LOWER() Examples

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

Basic Usage

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

SELECT
    NLS_LOWER('Hello World') "Result"
FROM dual;

Output:

Result
______________
hello world

Collation

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

SELECT
    NLS_LOWER('NOKTASINDA') "Result1",
    NLS_LOWER('NOKTASINDA', 'NLS_SORT = XTurkish') "Result2"
FROM dual;

Output:

Result1       Result2
_____________ _____________
noktasinda    noktasında

In this example, the lowercase of Turkish I is ı, not i.

NULL Parameters

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

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

Output:

NLS_LOWER(NULL)
__________________
NULL

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

Conclusion

Oracle NLS_LOWER() is a built-in function that returns the lowercase version of a given string.