I have a tablle like this.
cust acc
---------------
a 1
b 2|3
c 4|5|6

I Want below o/p:
cust acc
-----------
a 1
b 2
b 3
c 4
c 5
c 6
Please any one can you have any ideas share me.
I have urgent requirement.

Answer Posted / p deshmukh

SELECT distinct COL, trim(regexp_substr(colvalue, '[^|]+', 1, level)) colvalue
FROM (with demo as ( select '1' as a, '2|3' as b, '4|5|6' as c from dual )

select * from demo
unpivot
( colvalue for col in (a, b, c) )) t
CONNECT BY instr(colvalue, '|', 1, level - 1) > 0
order by col

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is normalisation in sql?

553


Why join is faster than subquery?

603


how do you know the version of your mysql server? : Sql dba

508


What are the query optimization techniques?

535


What are the different operators available in sql?

579






What are the limitations of sql express?

530


how to load data files into tables with 'mysqlimport'? : Sql dba

528


What is a .db file?

544


What is use of term?

626


List the various privileges that a user can grant to another user?

585


What is trigger in pl sql with examples?

525


What is the difference between stored procedure and view?

532


what are local and global variables and their differences? : Sql dba

542


what is query cache in mysql? : Sql dba

579


What is set serveroutput on?

644