I am trying to do this:
arrCauses := APEX_UTIL.STRING_TO_TABLE(:P1_CAUSE);
FOR c IN 1..arrCauses.count LOOP
INSERT INTO DT_EVENT_CAUSE (
EVENT_ID,
CAUSE_ID)
VALUES (
nextPK, c);
END LOOP;
or this
arrCauses := APEX_UTIL.STRING_TO_TABLE(:P1_CAUSE);
FOR c IN arrCauses.first..arrCauses.last LOOP
INSERT INTO DT_EVENT_CAUSE (
EVENT_ID,
CAUSE_ID)
VALUES (
nextPK, c);
END LOOP;
Problem is…c is always just the count, so if the array is 1 item, a c of 1 will be inserted. If the array if 3 items, c’s of 1, 2 and 3 will be inserted. As opposed to actual values from the array. What am I doing wrong?!
Use the index to retrieve the value within your array:
instead of
😉