I need a solution for mi problem. It doesn't necessarily have to be a Loop, i'm thankfull for every Input.
I have a Table with 262 entries in it. Let's call it EXPTB1. And i have a second Table EXPTB2 which is emtpy.
Now for each entry in EXPTB1 i need 6 entries in EXPTB2. And three Attributes will have to be filled. One is a Primary key, which is automaticly generated by a sequence. One is the foreign key of the entry of EXPTB1 and one contains six different numbers (Positions) for each of the 6 entries. The numbers would always be 1,2,3,11,12,13.
So i we look at a individual entry of EXPTB1 i need for each of ist objects the following query:
insert into EXPTB2(EXPTB2_ID,EXPTB2_EXPTB1_ID,EXPTB2_POSITION) values (EXPTB2_SEQ.nextval,EXPTB1_ID,1);
insert into EXPTB2(EXPTB2_ID,EXPTB2_EXPTB1_ID,EXPTB2_POSITION) values (EXPTB2_SEQ.nextval,EXPTB1_ID,2);
insert into EXPTB2(EXPTB2_ID,EXPTB2_EXPTB1_ID,EXPTB2_POSITION) values (EXPTB2_SEQ.nextval,EXPTB1_ID,3);
insert into EXPTB2(EXPTB2_ID,EXPTB2_EXPTB1_ID,EXPTB2_POSITION) values (EXPTB2_SEQ.nextval,EXPTB1_ID,11);
insert into EXPTB2(EXPTB2_ID,EXPTB2_EXPTB1_ID,EXPTB2_POSITION) values (EXPTB2_SEQ.nextval,EXPTB1_ID,12);
insert into EXPTB2(EXPTB2_ID,EXPTB2_EXPTB1_ID,EXPTB2_POSITION) values (EXPTB2_SEQ.nextval,EXPTB1_ID,13);
- Rownumber
- Primary Key - Created by sequence
- Foreign Key from a entry in EXPTB1
- Position
I hope my description is clear enough, it's a bit difficult to describe.. :)
Cheers Fabian