Reputation: 6875
I want to selec column names and convert to pascal case. My column names are like this:
I want to split "_" names and convert to:
I can get column names with sql
Select COLUMN_NAME from ALL_COL_COMMENTS WHERE TABLE_NAME="MY_TABLE;
But can not convert to pascalcase.
Upvotes: 0
Views: 647
Reputation: 8528
I don't know if always the underscore is the separator, but if it is, you can do this:
SQL> select replace(initcap('IMG_SAR_NAME'),'_','') from dual ;
REPLACE(IN
----------
ImgSarName
SQL>
The Oracle 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. A string whose first character in each word will be converted to uppercase and the rest characters will be converted to lowercase.
Upvotes: 2