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 are the advantages of oracle?
What is define in oracle?
What is the difference between hot backup and cold backup in oracle?
How to use group functions in the select clause using oracle?
How to list all user accounts in oracle?
What is a snapshot in oracle database?
Hi Masters, in Oracle Applications 11i, we hace 2 functions using the same form, i need to create 1 personalization, but that code must afect only one function.... how can i do that?
How do I find my oracle client driver version?
What is a nested table and how is it different from a normal table?
How to execute a stored program unit?
Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris).
Explain about achiever in sql?
How can I create database in oracle?
Is postgres faster than oracle?
defination of bitmap index