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 / devraj

Select Length('ram charan singh') - length(replace('ram
charan singh', ' ','')) from dual;

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is java required for oracle client?

554


How to update values on multiple rows in oracle?

602


What is java oracle used for?

528


Explain compound trigger in oracle?

555


How to divide query output into groups in oracle?

563






What operating systems are supported by oracle database 10g xe?

585


Explain the use of control file?

658


How to start a new transaction in oracle?

593


What are the uses of synonyms?

610


how to join query for one source type is oracle another source type is sql server ?

1995


What is a user account in oracle?

633


What are nested tables?

675


Can I create users through internet explorer in oracle 10g?

574


How to use "startup" command to start default instance?

547


What are the differences between char and nchar in oracle?

603