0

Basically what I want to achieve is looping through G_F0X array to make my code more compact without using for example:

APEX_APPLICATION.G_F01(1);
APEX_APPLICATION.G_F02(1);
APEX_APPLICATION.G_F03(1);

For sure, it's not working but I can't find any information anywhere and I don't know how to do it .

ex:

for counter in 1..3 loop
   APEX_APPLICATION.G_F0**{here comes the counter value}**(1);
end loop;
Adi
  • 311
  • 4
  • 19

1 Answers1

1

I don't know if there's a better way to do this, but you could create an array and store the g_fXX variables inside it. like:

declare
  type t_vc_arr2 is table of apex_application_global.vc_arr2;
  g_fXX t_vc_arr2 := t_vc_arr2 (
                       apex_application.g_f01
                      ,apex_application.g_f02
                      ,apex_application.g_f03
                      --,apex_application.g_fXX
                     );
begin
  for i in 1 .. g_fXX.count loop -- loop through each apex_application.g_fXX array
    for j in 1 .. g_fXX(i).count loop -- loop through each value of current apex_application.g_fXX array
      dbms_output.put_line(g_fxx(i)(j));
    end loop;
  end loop;
end;
/
Vih Damarques
  • 371
  • 1
  • 2
  • 7