Give SQL Query to find the number words in a sentence ?
ex: 'ram charan singh' then ans:3
Answer:select length(trim('ram charan singh')) - length
(replace
(trim ( 'ram charan singh'),' ','')) +1 from dual
The above query working properly when space between the
words is only one &similar
But ,If the space between the words is nonuniform.
Ex:'ram charan singh is good' ans:5
i am not getting this answer using above query.
Answer Posted / aseem k
a is only column for table e
select a,length(regexp_replace(regexp_replace(a, '[^ ]
{1,}','1') ,'( +){1,}',''))
from e
/
it took me exactly 90 min's
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is hash cluster in oracle?
What do you mean by a deadlock?
How to start your 10g xe server from command line?
How a tablespace is related to data files?
Is truncate autocommit in oracle?
Please explain drop constraint oracle?
How to use windows user to connect to the server?
How can we delete duplicate rows in a table?
What is the use of file param in imp command?
How to open a cursor variable?
Can we save images in a database and if yes, how?
What is oracle update statement with inner join ?
Is it possible to insert comments into sql statements return in the data model editor ?
In what script is snap$ created? In what script is the scott/tiger schema created?
Please explain joins in oracle?