need to split a string into separate values.
eg.
col1 col2
----------
100 - 'a,b,c'
200 - 'a,x,d,e'
300 - 'c'
result:
value count
-------------
a - 2
b - 1
c - 2
etc.
Answer Posted / sharath
select count(substr('a,b,c',',',instr('a,b,c',',',1,1)-1))
,count(substr('a,b,c',instr('a,b,c',',',1,1)+1,instr
('a,b,c',',',2,1)-instr('a,b,c',',',1,1)-1))
,count(substr('a,b,c',instr('a,b,c',',',2,1)-1)) from
table_name;
| Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
What is a join?
Explain ddl statements in pl/sql?
What are the query optimization techniques?
what is the stuff function and how does it differ from the replace function? : Sql dba
What is the use of nvl function?
Write a query to find the names of users that begin with "um" in sql?
What does trigger mean in slang?
How do you define a foreign key?
Why function is used in sql?
what is union? : Sql dba
explain the delete statements in sql
What is type and rowtype in pl sql?
Can we perform dml in function?
How is a process of pl/sql compiled?
Describe types of sql statements?