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 / murali mohan
Try This in 10g
SELECT length(REGEXP_REPLACE('ram charan
singh is good',
'( ){2,}', ' ')) - length(replace (trim ( 'ram
charan singh is good'),' ','')) +1
AS RX_REPLACE
FROM dual;
Regards,
Murali
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is user managed backup in Oracle?
What is a table index?
what is the dual table in oracle?
what happened to the global index when I truncate the data in one of the partition?
What is a dynamic performance view in oracle?
How would you best determine why your MVIEW couldnt FAST REFRESH?
How to find out what oracle odbc drivers are installed?
List out the difference between commit, rollback, and savepoint?
How to start your 10g xe server from command line?
How to insert a new row into a table in oracle?
WHAT IS ecc 6.0
What language does oracle use?
Explain the use of grant option in exp command.
what is port in oracle? how is it related to database application.
What is an oracle and why it is used?