write a sql query following source looking like below
column1 column2
101,102,103 abc,def,ghi
1001,1002,1003 a,b,c
i want the output
column1 column1
101 abc
102 def
103 ghi
1001 a
1002 b
1003 c
Answer Posted / farrukhshaikh
select vw1.str, vw2.str
from (select rownum sr,
substr(col,
instr(col, ',', 1, level) + 1,
instr(col, ',', 1, level + 1) -
instr(col, ',', 1, level) - 1) str
from (select ',' || qry || ',' col
from (select '101,102,103,1001,1002,1003'
qry from dual))
connect by level <= length(col) - length(replace
(col, ',')) - 1) vw1,
(select rownum sr,
substr(col,
instr(col, ',', 1, level) + 1,
instr(col, ',', 1, level + 1) -
instr(col, ',', 1, level) - 1) str
from (select ',' || qry || ',' col
from (select 'abc,def,ghi,a,b,c' qry from
dual))
connect by level <= length(col) - length(replace
(col, ',')) - 1) vw2
where vw1.sr = vw2.sr
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the difference between sharding and replication?
Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.
What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?
how to convert .db (extention) database file into .dmp (extention ) for oracle database ?
What is catalog in Oracle?
What is the sid in oracle?
What is varray?
Please explain drop constraint oracle?
What is the difference between count (*), count (expression), count (distinct expression)?
What is different types of joins?
WHAT IS ecc 6.0
What is define in oracle?
How to resolve the ORA-39133 error in Oracle?
Explain what are clusters?
can anyody please send me the dump for Oracle 10g certifications for DBA path?