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 / kavitha nedigunta

create table test001 (cuss varchar2(10), acc varchar2(30));

insert into test001 values ('a','1');

insert into test001 values ('b','2|3');

insert into test001 values ('c','4|5|6');

WITH CTE AS (SELECT CUSS,ACC FROM TEST001)
select distinct trim(regexp_substr( acc, '[^|]+', 1,
level)) acc ,cuss from cte
CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(ACC, '[^|]+')) +
1;

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is record variable?

551


How does rowid help in running a query faster?

968


What is compound trigger?

553


How can I speed up sql query?

522


What is crud sql?

539






How do I upgrade sql?

546


Is id a reserved word in sql?

658


What is dbo in sql?

533


What are triggers in sql?

580


Is primary key is clustered index?

527


What are sql built in functions?

508


How to read xml file in oracle pl sql?

506


What is a record in a database?

559


discuss about myisam key cache. : Sql dba

561


How do you update a table in sql?

519