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 pass parameters to procedures in oracle?
Explain the use of owner option in exp command.
What are the built-in functions used for sending Parameters to forms ?
What does sharding mean?
HI ALL, CAN ANYONE TELL ME THE DIFFERENCES BETWEEN SQL CLUSTURS,MSQL CLUSTERS,ORACLE CLUSTERS.......THANKS IN ADVANCE
Explain an extent?
How to find the duplicate rows count from employees table in oracle?
How can I combine multiple rows into a comma-delimited list in oracle?
How to use windows user to connect to the server?
Can you have more than one content canvas view attached with a window ?
How to convert a date to char in oracle? Give one example.
What is bulk copy or bcp in oracle?
Is there any function in oracle similar like group_concat of mysql?
what are archived logs?
What do the 9i dbms_standard.sql_txt() and dbms_standard.sql_text() procedures do?