INITCAP scalar function

The INITCAP function returns a string with the first character of each word converted to uppercase, using the UPPER function semantics, and the other characters converted to lowercase, using the LOWER function semantics.

Read syntax diagramSkip visual syntax diagramINITCAP(string-expression )

The schema is SYSIBM.

A word is delimited by any of the following characters:
Table 1. Word delimiter characters
Character or range of characters Unicode code points or range of Unicode code points
(blank) U+0020
! " # $ % & ' ( ) * + , -. / U+0021 to U+002F
: ; < = > ? @ U+003A to U+0040
[ \ ] ^ _ ` U+005B to U+0060
{ | } ~ U+007B to U+007E
Control characters, including the following SQL control characters:
  • tab
  • new line
  • form feed
  • carriage return
  • line feed
U+0009, U+000A, U+000B, U+000C, U+000D, U+0085
Note: A character listed in the preceding table might not have an allocated code point in a particular database code page.
string-expression
An expression that returns a CHAR or VARCHAR data type. In a Unicode database, the expression can return a GRAPHIC or VARGRAPHIC data type.
The data type of the result depends on the data type of string-expression, as described in the following table:
Table 2. Data type of string-expression compared to the data type of the result
Data type of string-expression Data type of the result
CHAR or VARCHAR VARCHAR
GRAPHIC or VARGRAPHIC VARGRAPHIC
The length attribute of the result is the same as the length attribute of string-expression.

If the argument can be null, the result can be null; if the argument is null, the result is the null value.

Examples

  • Example 1: Input the string a prospective book title to return the string A Prospective Book Title.
    VALUES INITCAP ('a prospective book title')
    1 
    ------------------------
    A Prospective Book Title  
  • Example 2: Input the string YOUR NAME to return the string Your Name.
    VALUES INITCAP ('YOUR NAME') 
    1 
    ---------
    Your Name  
  • Example 3: Input the string my_résumé to return the string My_Résumé.
    VALUES INITCAP ('my_résumé')
    1 
    --------- 
    My_Résumé
  • Example 4: Input the string élégant to return the string Élégant.
    VALUES INITCAP ('FORMAT:élégant')  
    1 
    -------------- 
    Format:Élégant