Oracle parameter可以通過以下方法傳遞數組:
CREATE OR REPLACE TYPE my_table_type AS TABLE OF VARCHAR2(50);
/
CREATE OR REPLACE PROCEDURE my_procedure (my_array IN my_table_type) IS
BEGIN
-- Do something with the array
END;
CREATE OR REPLACE TYPE my_varray_type AS VARRAY(10) OF VARCHAR2(50);
/
CREATE OR REPLACE PROCEDURE my_procedure (my_array IN my_varray_type) IS
BEGIN
-- Do something with the array
END;
CREATE OR REPLACE PROCEDURE my_procedure (my_array VARCHAR2) IS
BEGIN
-- Do something with the array
END;
/
DECLARE
my_array my_table_type := my_table_type('value1', 'value2', 'value3');
BEGIN
my_procedure(my_array);
END;
無論哪種方法,都可以有效地將數組作為參數傳遞給Oracle存儲過程或函數。