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
Can we create view in stored procedure?
Explain what is a subquery ?
What does subquery mean in sql?
Can you join views in sql?
what is a table in a database ? : Sql dba
What is use of package in pl sql?
How do you create a unique index?
Explain the difference in execution of triggers and stored procedures?
How to prepare for oracle pl sql certification?
GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?
what are the advantages of using stored procedures? : Sql dba
Is there a way to automate sql execution from the command-line, batch job or shell script?
What are views in sql?
What is the difference between numeric and autonumber?
Is coalesce faster than isnull?