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

Why is a primary key important?

726


What is a sql schema used for?

727


What do you know by pl/sql cursors?

756


How do you delete data from a table?

731


Advantages and disadvantages of stored procedure?

795






Are ddl triggers fired for ddl statements within a pl/sql code executed using the dbms.sql package?

833


What is the difference between a primary key and a unique key?

742


What is the source code of a program?

704


what is row? : Sql dba

928


How does cross join work?

654


Can %notfound return null after a fetch?

755


Which tcp/ip port does sql server run?

715


What is the difference between syntax error and runtime error?

805


How do you select unique values in sql?

697


What are the packages in pl sql?

741