if a string is there like s1,s2,s3,s4.How to find count of
commas in this.

Answers were Sorted based on User's Feedback



if a string is there like s1,s2,s3,s4.How to find count of commas in this...

Answer / ajit

select 's1,s2,s3,s4' str,
length('s1,s2,s3,s4') - length(replace('s1,s2,s3,s4', ',')) str2
from dual;

Is This Answer Correct ?    11 Yes 1 No

if a string is there like s1,s2,s3,s4.How to find count of commas in this...

Answer / prashant

14:41:23 SQL> SELECT regexp_count ('s1,s2,s3,s4', ',')
14:41:24 2 FROM DUAL;

REGEXP_COUNT('S1,S2,S3,S4',',')
-------------------------------
3

Elapsed: 00:00:00.00
14:41:26 SQL>

Is This Answer Correct ?    9 Yes 2 No

if a string is there like s1,s2,s3,s4.How to find count of commas in this...

Answer / debbie

select
length('s1,s2,s3,s4')-length(replace('s1,s2,s3,s4',',')) as
Count_comma from dual

Is This Answer Correct ?    1 Yes 0 No

if a string is there like s1,s2,s3,s4.How to find count of commas in this...

Answer / ashok

SELECT LENGTH(REGEXP_REPLACE('s1,s2,s3,s4', '[s0-9]', '')) FROM dual

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Is it possible to remove child records without removing master table records...the two having pk,fk relationship?

0 Answers  


Can sql developer connect to db2?

0 Answers  


What is the difference between SQL Constraint and PL/SQL constraint.Pls give all the constraint name.

3 Answers   TCS,


How many sql commands are there?

0 Answers  


What is the location of pre_defined_functions.

0 Answers  






What is the difference between join and union.

27 Answers   3i Infotech, ABC, Oracle, Polaris, TCS, XT Global,


How to read xml file in oracle pl sql?

0 Answers  


If we declare constraints Unique and Not null on a single column then it will act as a Primary key, so what is the use of primary key??

3 Answers  


Does mysql_real_escape_string prevent sql injection?

0 Answers  


Is sql dba a good career? : SQL DBA

0 Answers  


what are the different functions in sorting an array? : Sql dba

0 Answers  


Can you selectively load only those records that you need? : aql loader

0 Answers  


Categories