Oracle Database 10g Enterprise Edition Release 10.2.0.5.0
I have the following code, which works, but only if the count of the subscript from suppObj.approvers =6. While yes I could add a check for the subscript
but then the code starts to become even more repetitive and the code does not scale dynamically.
BEGIN
p_new_app_plan_no_sig1_invalid := suppObj.approvers(1).personCodeInvalid;
p_new_app_plan_no_sig2_invalid := suppObj.approvers(2).personCodeInvalid;
p_new_app_plan_no_sig3_invalid := suppObj.approvers(3).personCodeInvalid;
p_new_app_plan_no_sig4_invalid := suppObj.approvers(4).personCodeInvalid;
p_new_app_plan_no_sig5_invalid := suppObj.approvers(5).personCodeInvalid;
p_new_app_plan_no_sig6_invalid := suppObj.approvers(6).personCodeInvalid;
END;
I would prefer to use code something similar to this, but unfortunately this throws
ERROR .... Found 'p_new_app_plan_no_sig', Expecting CASE or another statement
Using a for loop would also avoid any ORA-06533: Subscript beyond count errors if the COUNT of suppObj.approvers was not equal to 6
FOR i IN 1..suppObj.approvers.COUNT
LOOP
'p_new_app_plan_no_sig'||i||'_invalid' := suppObj.approvers(i).personCodeInvalid;
END LOOP;
END;
Does anybody have any ideas on how this could be achieved.
many thanks.