[ACCEPTED]-how to create a stored procedure in oracle which accepts array of parameters-stored-procedures
Accepted answer
Yes. Oracle calls them collections and 2 there's a variety of collections you can 1 use.
A simple array example using a VARRAY.
DECLARE
TYPE Str_Array IS VARRAY(4) OF VARCHAR2(50);
v_array Str_Array;
PROCEDURE PROCESS_ARRAY(v_str_array Str_Array)
AS
BEGIN
FOR i IN v_str_array.first .. v_str_array.last LOOP
DBMS_OUTPUT.PUT_LINE('Hello '||v_str_array(i));
END LOOP;
END;
BEGIN
v_array := Str_Array('John','Paul','Ringo','George');
PROCESS_ARRAY(v_array);
-- can also pass unbound Str_Array
PROCESS_ARRAY(Str_Array('John','Paul','Ringo','George'));
END;
If I'm not wrong, there's a native type 4 called TABLE that basically is an array. But 3 last time I used it was 2001 so maybe there 2 are most powerful types nowadays.
Check this 1 http://www.developer.com/db/article.php/3379271
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.