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



Give SQL Query to find the number words in a sentence ? ex: 'ram charan singh' then ans:3..

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

Give SQL Query to find the number words in a sentence ? ex: 'ram charan singh' then ans:3..

Answer / devraj

Select Length('ram charan singh') - length(replace('ram
charan singh', ' ','')) from dual;

Is This Answer Correct ?    1 Yes 1 No

Give SQL Query to find the number words in a sentence ? ex: 'ram charan singh' then ans:3..

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

Post New Answer

More Oracle General Interview Questions

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

0 Answers  


What is Database Buffers ?

1 Answers  


What are the types of Database Links ?

2 Answers  


i deleted 4 records form the table.after i have applied commit .now i want to get back those records.how?

7 Answers   HCL, IBM,


Is there any function in oracle similar like group_concat of mysql?

0 Answers  






Do View contain Data ?

10 Answers  


how to insert data into partitioned table partition done by Range partition

1 Answers  


without using count(*) and rownum how can we count total record in a table

5 Answers   AC, HP,


How to define an anonymous procedure without variables?

0 Answers  


What is an Oracle view?

1 Answers  


while i take backup using ibm tsm the following errors occurred: rman-03009 ora-19513 ora-27206 ora-19502 ora-27030 ora-ora19511

0 Answers  


Can select statements be used on views in oracle?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)