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


Please Help Members By Posting Answers For Below Questions

How to initialize variables with default values?

638


What is meant by an index?

629


Explain how are indexes update?

623


How to load a large xml file?

586


How to create a table interactively?

562






What is a user role in oracle?

617


How to create lov dynamically at runtime & attach to text field?

666


What is the recommended interval at which to run statspack snapshots, and why?

2437


We are using Oracle apps with XML publisher.In that,we are facing some problems while giving a Footer in RTF Template.While giving a footer in RTF Template it is Visible in all the pages,but after the PDF is getiing generated,the Footer are Visible on alternate pages only (like on first page ,third page) and so on. Please provide the Solution for getting the Footer on all the pages.

4934


What is clustered table in Oracle?

645


What do you mean by cdb and pdb in oracle 12c?

641


Why does for update in oracle 8 cause an ora-01002 error?

553


What is the parameter mode that can be passed to a procedure?

578


What are the execution control statements?

621


How to find out what oracle odbc drivers are installed?

578