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 are the varoius components of physical database structure of oracle database?
Can you drop an index associated with a unique or primary key constraint?
What are triggers in oracle?
What is a subquery?
Can a parameter be passed to a cursor?
How to define a data field as not null?
what are the advantages of running a database in archive log mode?
What is memory advisor in Oracle?
How many types of tables supported by oracle?
What is the best way to do multi-row insert in oracle?
How to join two tables in a single query using oracle?
How to bring a tablespace offline?
How do I uninstall oracle 11g?
Explain oracle 12c new features for developers?
Why do we use coalesce function in oracle?