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 / aseem k
a is only column for table e
select a,length(regexp_replace(regexp_replace(a, '[^ ]
{1,}','1') ,'( +){1,}',''))
from e
/
it took me exactly 90 min's
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is a nested table and how is it different from a normal table?
How to get a create statement for an existing table?
What is a cursor and what are the steps need to be taken?
How to get execution path reports on query statements?
Provide an example of a shell script which logs into SQLPLUS as SYS, determines the current date, changes the date format to include minutes & seconds, issues a drop table command, displays the date again, and finally exits.
For a field in a repeating frame, can the source come from the column which does not exist in the data group which forms the base for the frame ?
Why do we use coalesce function in oracle?
How to drop a tablespace?
Is oracle a language?
Can multiple columns be used in group by in oracle?
what happened to the global index when I truncate the data in one of the partition?
Give the advantages and disadvantages of clusters.
How to create a new table by selecting rows from another table?
How to create a new tablespace in oracle?
How do I find the database name in oracle?