Hi ,
the above query is able to format the output upto two words in a string, its not searching for the second space.
column data as below before query run:
wrath of titans
serious hospital (disk) fnut
Query :
Select
CASE
WHEN col_name LIKE '% %' -- LAST NAMES WITH HYPHENS IN THEM - DISPLAY AS : JONES-SMITH
THEN SUBSTR(col_name,1,1) || LOWER(SUBSTR(col_name, 2, INDEX(col_name, '') -2)) || '' ||
SUBSTR(col_name, INDEX(col_name, '') +1,1) || LOWER(SUBSTR(col_name, INDEX(col_name, '')+2))
ELSE -- REGULAR ONE WORD LAST NAMES
SUBSTR(col_name,1,1) || LOWER(SUBSTR(col_name,2))
END AS col_name
from database.table;
Data after query run as below:
Wrath Of titans
Serious Hospital (disk) fnut --- Third word is not changing to proper case.
Required data as below shud be:
Wrath Of Titans
Serious Hospital (Disk) Fnut.
Kindly suggest.
Hi ,
the above query is able to format the output upto two words in a string, its not searching for the second space.
column data as below before query run:
wrath of titans
serious hospital (disk) fnut
Query :
Select
CASE
WHEN col_name LIKE '% %' -- LAST NAMES WITH HYPHENS IN THEM - DISPLAY AS : JONES-SMITH
THEN SUBSTR(col_name,1,1) || LOWER(SUBSTR(col_name, 2, INDEX(col_name, '') -2)) || '' ||
SUBSTR(col_name, INDEX(col_name, '') +1,1) || LOWER(SUBSTR(col_name, INDEX(col_name, '')+2))
ELSE -- REGULAR ONE WORD LAST NAMES
SUBSTR(col_name,1,1) || LOWER(SUBSTR(col_name,2))
END AS col_name
from database.table;
Data after query run as below:
Wrath Of titans
Serious Hospital (disk) fnut --- Third word is not changing to proper case.
Required data as below shud be:
Wrath Of Titans
Serious Hospital (Disk) Fnut.
Kindly suggest.