i want count no of values in a column i.e
enam eempno phoneno
x 1 (98765,09887,096561,87964579,156678,678900876)
that means if i select phone no from table i want to get
total count of phone numbers i.e 6
Answers were Sorted based on User's Feedback
Answer / kavitha nedigunta
select count(*) from(
select trim(regexp_substr(initcap(phoneno),'[^,]+',1,level)) as phoneno
from testphone
connect by level <= length(regexp_replace(phoneno,'[^,]'))+1
)a
it will work in oracle 10g on words.
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / sarath
select length(phoneno)-length(replace(phoneno,','))+1 as TOTALCOUNT from <tablename>
For few friends who sent count(*) I wanna say something that
Its a SINGLE (FIELD VALUE)STRING CONTAINING MULTIPLE PHONENOs
Is This Answer Correct ? | 5 Yes | 0 No |
Answer / nitin vartak
select enam ,eempno , (len(phoneno) - len(replace
(phoneno,',',''))) + 1 from TableName
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / venkat
select count(column_name) from table_name;
if u want to count number of phone numbers then use below
from emp table
select count(phno) from emp;
Is This Answer Correct ? | 3 Yes | 4 No |
Answer / rolly
select count(&a) from emp
enter the column name at run time it will give the exact
count.
I have tested it. It works.
Is This Answer Correct ? | 2 Yes | 4 No |
difference between SQL and C
1 Answers Indus Software Technologies,
what are the features and advantages of object-oriented programming? : Sql dba
What are the conditions an underlying table must satisfy before a cursor can be used by a positioned update or delete statement? : Transact sql
What is sql exception?
what are the advantages of mysql in comparison to oracle? : Sql dba
Why are sql stored procedures used?
how can you see all indexes defined for a table? : Sql dba
What is character functions?
What is a system versioned table?
Do stored procedures prevent sql injection?
Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.
What is the difference between count 1 and count (*) in a sql query?