I want to pass multiple product keys to a procedure, like product 1,2,5,7
I'm calling the procedure the following way:
call procedure_test('emp1',(1,2,5,7));
passed with the following where
condition:
i:= (1,2,5,7)
where a.products in (i)
I want to pass multiple product keys to a procedure, like product 1,2,5,7
I'm calling the procedure the following way:
call procedure_test('emp1',(1,2,5,7));
passed with the following where
condition:
i:= (1,2,5,7)
where a.products in (i)
Since I love a good associative array, here is my take (even though what jeff6times7 suggested is just as good) :
DECLARE
-- Declare the associative array type
TYPE typTabProductID IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
-- Array variable, used for test only
tableTest typTabProductID;
-- Procedure eating a parameter of array type
PROCEDURE myProc(tabProductID typTabProductID) IS
BEGIN
FOR i IN 1 .. tabProductID.COUNT LOOP
dbms_output.put_line(tabProductID(i));
END LOOP;
END;
BEGIN
-- Fill the array variable
tableTest(1) := 5;
tableTest(2) := 8;
tableTest(3) := 11;
-- call the procedure
myProc(tableTest);
END;