Home » SQL & PL/SQL » SQL & PL/SQL » Problem in Sql
Problem in Sql [message #273737] Thu, 11 October 2007 09:28 Go to next message
Messages: 9
Registered: September 2007
Junior Member

I'm having one table with the column name as "description" and it has the following values.


I've written the following query to make every thing as lower case and INITCAP of first letter and also the to retrive the characters after "_".

I'm facing one problem here,Query is working fine,but for "2BELL" it is retrieving me as "2bell",I want to display it as "2Bell".

Select INITCAP(lower(trim(substr(data_center.DESCRIPTION, instr(data_center.DESCRIPTION, '_', 1)+1)))) as datacenter from data_center;

Please advise me for any suggestions..

Re: Problem in Sql [message #273856 is a reply to message #273737] Fri, 12 October 2007 00:42 Go to previous message
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member

may be you will find better solutions than this.
with data as 
(select '2bell' name from dual union all
select 'fall' from dual union all
select 'light' from dual
select decode(regexp_instr(name,'[0-9]'),1,substr(name,1,1)||initcap(substr(name,2)),
initcap(name)) name from data

Previous Topic: pl/sql
Next Topic: PL/SQL Cursor question
Goto Forum:

Current Time: Thu Oct 27 19:36:06 CDT 2016

Total time taken to generate the page: 0.06577 seconds