w3resource

Oracle NLS_INITCAP function

Description

The Oracle NLS_INITCAP() function sets the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric. This function supports National Language Support (NLS), enabling it to handle linguistic conventions for different languages.

Note: National Language Support (NLS) is a technology enabling Oracle applications to interact with users in their native language, using their conventions for displaying data.

Uses of Oracle NLS_INITCAP Function
  • Standardizing Text Formats: Converts text to a consistent format with initial capital letters for each word.

  • Improving Readability: Enhances the readability of text by capitalizing the first letter of each word.

  • Supporting Multiple Languages: Handles case conversions according to linguistic rules for various languages.

  • Formatting User Inputs: Ensures user input follows a standard capitalization format.

  • Preparing Data for Display: Formats text data for display in reports, GUIs, and other interfaces.

  • Data Cleaning and Normalization: Normalizes text data to a consistent format before storage or processing.

Syntax:

NLS_INITCAP(string1 [, 'nlsparam' ])

Parameters:

Name Description Data Types
string1 A string whose first character in each word will be converted to uppercase and the rest characters will be converted to lowercase. CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB
nlsparam The value of 'nlsparam' can have this form :
'NLS_SORT = sort' where sort is either a linguistic sort sequence or BINARY. The linguistic sort sequence handles special linguistic requirements for case conversions. These requirements can result in a return value of a different length than the char. If you omit 'nlsparam', then this function uses the default sort sequence for your session.
 

Return Value Type :

CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB

This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion.

Examples: Oracle NLS_INITCAP function

The following examples show how the linguistic sort sequence results in a different return value from the function :

Sample Output:

SQL> SELECT NLS_INITCAP('ijzer') "Initcap" FROM DUAL;

Initc
-----
Ijzer

SQL> SELECT NLS_INITCAP('ijzer', 'NLS_SORT = XDutch') "InitCap"  FROM DUAL;

InitC
-----
IJzer

Previous: NCHR
Next: NLS_LOWER



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/oracle/character-functions/oracle-nls_initcap-function.php