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


Please Help Members By Posting Answers For Below Questions

What are the oracle built-in data types?

566


How can I get column names from a table in oracle?

538


Please send me Informatica 8.1 certification dumps, my mail id mona85gupta@gmail.com

1444


Give syntax for SQL and ORACLE joins.

636


What do you mean by a database transaction & what all tcl statements are available in oracle?

555






What is a parameter file in oracle?

564


What are the extensions used by oracle reports?

577


What is enter substitution variable in oracle?

577


What is an oracle cursor variable?

612


What is index-organized table in Oracle?

575


HI Friends Myself Manoj,i am from bengaluru.i have 1 yr of exp in PLSQL but not upto the mark..now attending interviews but m not able to clear even 1 round..i have attended 3 interviews till today.purpose of writing this query is,i want to know the intreview topics that interviewer going to ask frequently,mainly SCENARIO based questions.IF anybody have any PLSQL projects please give it to me,it will helps me alot.Thanks for your patience.

998


What are the parameters that we can pass through a stored procedure?

559


What is merge in oracle?

564


What is an index associated with a constraint?

554


State and explain about oracle instance?

551