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 sn
substr('a,b,c',',',instr('a,b,c',',',1,1)-1)
,substr('a,b,c',instr('a,b,c',',',1,1)+1,instr
('a,b,c',',',2,1)-instr('a,b,c',',',1,1)-1)
,substr('a,b,c',instr('a,b,c',',',2,1)-1);
Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
How do I run a sql script?
Differentiate between % rowtype and type record.
how tsql statements can be written and submitted to the database engine? : Transact sql
Difference between truncate, delete and drop commands?
How do I view a table in sql?
How do rank () and dense_rank () differ?
how to use regular expression in pattern match conditions? : Sql dba
What is the use of nvl function?
define sql insert statement ? : Sql dba
Where the sql database files are stored?
How does index help in query performance?
how to show all tables with 'mysql'? : Sql dba
How do I restart sql?
What are all types of user defined functions?
What is sql data?