Capitalize Each Word!



INITCAP

Syntax: initcap(variable)

Parameters: Variable -> String/Char/Number/Date type

Return Type:
If the variable is String/Char type than first character in each word will be converted to uppercase and all remaining characters converted to lowercase.
If the variable is Number Type/Date Type then it gets converted into String type(VARCHAR) without impacting its value.

Usage/Used Cases:
(i) When manager wants useful information that could be extracted from given string. However, for presentation purposes, the extracted substring’ s first character should be in Upper case.

SELECT INITCAP(SUBSTR(STREET_ADDRESS,1,10)) FROM LOCATIONS;

(ii) If manager wants to extract name of the countries such as USA, UK where organization has its presence.

SELECT * FROM COUNTRIES
WHERE INITCAP(COUNTRY_NAME) LIKE '%U';

(iii) If manager wants to format the record and wants to make it more representable.

SELECT INITCAP(START_DATE), INITCAP(END_DATE) FROM JOB_HISTORY;

Comments

Popular posts from this blog

Let's learn Left Outer Join!

Let's extract STRING!

Let's learn Cross Join!