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 / 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 |
What is Water Mark in Oracle?
select to_char('10','10') from dual This gives me an error oRA-1481 INVALID NUMBER FORMAT MODEL why? pls help
what is the scripts in data base?
How do we get field detail of a table?
What are ddl statements in oracle?
how to get the no employee in each department including the dept which has 0 employee
How to concatenate two text values in oracle?
What is object data modeling?
Design database draw er diagram for a certain scenario ?
0 Answers Keane India Ltd, TATA,
Explain the concept of the DUAL table.
select statement does not retrieve any records. what exception is raised?
10. Display the client number, order date and shipping date for all orders where the shipping date is between three and six months after the order date.