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.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / devraj
Select Length('ram charan singh') - length(replace('ram
charan singh', ' ','')) from dual;
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / 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 |
What are the parameters that we can pass through a stored procedure?
What is Database Buffers ?
What are the types of Database Links ?
i deleted 4 records form the table.after i have applied commit .now i want to get back those records.how?
Is there any function in oracle similar like group_concat of mysql?
Do View contain Data ?
how to insert data into partitioned table partition done by Range partition
without using count(*) and rownum how can we count total record in a table
How to define an anonymous procedure without variables?
What is an Oracle view?
while i take backup using ibm tsm the following errors occurred: rman-03009 ora-19513 ora-27206 ora-19502 ora-27030 ora-ora19511
Can select statements be used on views in oracle?