create table test_tab
(id number
,col1 varchar2(100)
)
Table created.
create or replace package test_pkg is
--
type ta_test_tab IS TABLE OF test_tab%ROWTYPE INDEX BY PLS_INTEGER;
--
PROCEDURE ins_test_tab
(pa_test_tab IN ta_test_tab
);
end test_pkg;
Package created.
create or replace package body test_pkg is
--
PROCEDURE ins_test_tab
(pa_test_tab IN ta_test_tab
)
IS
BEGIN
INSERT INTO test_tab
SELECT *
FROM TABLE(pa_test_tab)
;
END ins_test_tab;
end test_pkg;
declare
a_test_tab test_pkg.ta_test_tab;
r_test_tab test_tab%ROWTYPE;
BEGIN
r_test_tab.id := 1;
r_test_tab.col1 := 'abc';
--
a_test_tab(1) := r_test_tab;
--
r_test_tab.id := 2;
r_test_tab.col1 := 'def';
--
a_test_tab(2) := r_test_tab;
--
test_pkg.ins_test_tab(pa_test_tab => a_test_tab);
end;