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 / punith

SELECT a,
REGEXP_SUBSTR (b, '([^|]+)', 1, lvl) b


FROM dummy,
(SELECT LEVEL lvl
FROM (SELECT MAX (LENGTH (REGEXP_REPLACE
(b, '[^|]'))) mx
FROM dummy)
CONNECT BY LEVEL <= mx + 1)
WHERE lvl - 1 <= LENGTH (REGEXP_REPLACE (b, '[^|]'));

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is consistency?

696


Mention what are different methods to trace the pl/sql code?

547


what is “go” in t-sql? : Transact sql

591


How to use sql statements in pl/sql?

568


Does db2 use sql?

502






How do you declare a variable in pl sql?

526


What is sql and how does it work?

534


What is the difference between drop and truncate commands?

477


What is the difference between sql, mysql and sql server?

523


Explain spool.

677


What is composite primary key in sql?

512


Is there a way to automate sql execution from the command-line, batch job or shell script?

545


What is the process of copying data from table a to table b?

587


can sql servers linked to other servers like oracle? : Sql dba

537


What is difference between mysql and postgresql?

504