Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multiple for loops in page items for inserting data into table

hiddenonearthDec 21 2020

Hello,
I am stuck with the problem where I want to insert comma-separeted page items (i.e. owner, participant, owner_rights, participant_rights. The page items owner and participant can have one or multiple values seperated with a comma. The rights are selected via a radio group.
What I tried was the following:
declare

l_owner APEX_APPLICATION_GLOBAL.VC_ARR2;
l_participant APEX_APPLICATION_GLOBAL.VC_ARR2;
l_owner_rights APEX_APPLICATION_GLOBAL.VC_ARR2;
l_participant_rights APEX_APPLICATION_GLOBAL.VC_ARR2;
begin
l_owner := APEX_UTIL.STRING_TO_TABLE(:P1_OWNER, ',');
l_participant := APEX_UTIL.STRING_TO_TABLE(:P1_PARTICIPANT, ',');
l_owner_rights:= APEX_UTIL.STRING_TO_TABLE(:P1_OWNER_RIGHTS, ',');
l_participant_rights := APEX_UTIL.STRING_TO_TABLE(:P1_PARTICIPANT_RIGHTS, ',');

for i in 1.. l_owner.count
loop
for j in 1.. l_participant.count
loop
for k in 1.. l_owner_rights.count
loop
for l in 1.. l_participant_rights.count
loop

INSERT INTO TEAM_RIGHTS (date, owner, participant, owner_rights, participant_rights)

VALUES (:sysdate, l_owner(i), l_participant(j), l_owner_rights(k), l_participant_rights(l));

end loop i;
end loop j;
end loop k;
end loop l;
end;
Although the code validates, I get the error message when running the page saying the element iD for participant wasn't found.
Any idea on how to solve this problem? Or is there a better workaround for this issue?
Thanks.

Comments
Post Details
Added on Dec 21 2020
8 comments
884 views