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.
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / 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 |
How do you select unique values in sql?
Can I copy :old and :new pseudo-records in/to an oracle stored procedure?
What is the difference between local and global temporary table?
Explain the purpose of %type and %rowtype data types with the example?
What is microsoft t sql?
what is myisam? : Sql dba
How many columns should be in an index?
How to display Row Number with Records in Oracle SQL Plus?
What is composite primary key in sql?
what is cursor. write example of it. What are the attributes of cursor.
What is meant by <> in sql?
What is the difference between the sql*loader and import utilities? : aql loader