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

How many commands are there in sql?

745


Is a secondary key the same as a foreign key?

669


How you improve the performance of sql*loader? : aql loader

748


Why do we use procedures?

694


How many types of triggers exist in pl/sql?

727






What is sql lookup?

681


What is crud sql?

706


What is query execution plan in sql?

771


Can a commit statement be executed as part of a trigger?

795


How do I count rows in sql query?

688


What does the base_object_type column shows in the user.triggers data dictionary view?

757


what is a field in a database ? : Sql dba

754


How to run sql statements with oracle sql developer?

789


What is sql data?

704


Define concurrency control. : Transact sql

788