SQL Tutorial SQL Advanced SQL Database SQL References

Oracle INITCAP() Function



The Oracle (PL/SQL) INITCAP() function converts the first letter of each word to upper case and the rest to lower case. Words are sequences of alphanumeric characters separated by non-alphanumeric characters. If there are characters in the string that are not letters, they will be unaffected by this function.

Syntax

INITCAP(string)

Parameters

string Required. Specify the string to convert.

Return Value

Returns the string with first letter of each word to upper case and the rest to lower case.

Example 1:

The example below shows the usage of INITCAP() function.

INITCAP('Learning Oracle is FUN!')
Result: 'Learning Oracle Is Fun!'

INITCAP('Oracle tutorial')
Result: 'Oracle Tutorial'

Example 2:

Consider a database table called Employee with the following records:

EmpIDNameCityAgeSalary
1Johnlondon253000
2Marrynew york242750
3Joparis272800
4Kimamsterdam303100
5Rameshnew delhi283000
6Huangbeijing282800

The query given below is used to convert the City column values using this function.

SELECT Employee.*, 
INITCAP(City) AS INITCAP_Value 
FROM Employee;

The query will produce the following result:

EmpIDNameCityAgeINITCAP_Value
1Johnlondon25London
2Marrynew york24New York
3Joparis27Paris
4Kimamsterdam30Amsterdam
5Rameshnew delhi28New Delhi
6Huangbeijing28Beijing

❮ Oracle Functions