I have a function like this (unfortunately, I cannot change it to send one array instead of multiple parameters):
CREATE FUNCTION (p1_ IN OUT VARCHAR2(100), p2_ IN OUT VARCHAR2(100), <...>, p10_ IN OUT VARCHAR2(100)
IS
BEGIN
gather_value(p1_);
gather_value(p2_);
<...>
gather_value(p8_);
END;
To clean it up a little bit, I would prefer to change the body as follows:
IS
stmt VARCHAR2(1000);
BEGIN
FOR i IN 1 .. 8
LOOP
stmt := 'gather_value(p:1_);'
EXECUTE IMMEDIATE stmt USING i;
END LOOP;
END;
However, in that case no such parameters are found. Is there a way to work it around?