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
How to add another datafile to a tablespace?
What are ddl statements in oracle?
How would you go about verifying the network name that the local_listener is currently using?
What is a cursor in oracle?
How to delete a user account in oracle?
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?
What is the usage of analyze command in oracle?
interview questions with answer for cts
What is a read write transaction in oracle?
Is insert autocommit in oracle?
Differentiate between pre-select and pre-query?
What do you understand by database schema and what does it hold?
Please explain oracle left join with an example?
Illustrate how to determine the amount of physical CPUs a Unix Box possesses (LINUX and/or Solaris).
What is logical backup in oracle?