我想将多个产品密钥传递给某个过程,例如product 1,2,5,7
我通过以下方式调用该过程:
call procedure_test('emp1',(1,2,5,7));
通过了以下where
条件:
i:= (1,2,5,7)
where a.products in (i)
答案 0 :(得分:0)
由于我爱一个好的关联数组,所以这是我的看法(即使jeff6times7的建议也一样):
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;