How to get this working procedure to analyze the value of the list?

I have the following data in the table t1

ID DRUG_ID


DB00523 564; DB00926; DB03873

DB00893 566; DB01294; DB05260

the desired output is as the following table t2

ID DRUGID
DB00926 564
DB03873 564
566 DB01294
566 DB05260

I am trying to write a stored procedure to achieve the goal, since the actual list is very long. but it returns the error on the select part of the lower.

Any suggestion will be appreciated.

CREATE OR REPLACE PROCEDURE checklist IS

number of Oneid;
TYPE BBType IS REF CURSOR;
BBType BB;
onerecord Q1% ROWTYPE;


BEGIN

For oneid in (select id from t1) LOOP

FOR I IN 1.2 LOOP
Open BB for ' select id, substr (drug_id, instr(drug_id,';',1,i) + 1, instr(drug_id,';',1,i+1)-instr(drug_id,';',1,i)-1) from t1
loop
Retrieves BB in onerecord;
INSERT INTO t2 (ID, drugID) VALUES (onerecord.id, onerecord.drugid);
end loop;
close the BB;

ENDLOOP;

ENDLOOP;

END;

Frank,

Thank you very much for your help. It works very well!

Jane.

Tags: Database

Similar Questions

Maybe you are looking for