hi ,
i have a table T1 and i want to insert multiple rows at a time through procedure using collection..i have written the code but when i trying to execute it throws error ..please advise ..
create table t1 ( id number , name varchar2(10));
create or replace PACKAGE PKG1 AS
TYPE TAB_LIST IS TABLE OF T1%ROWTYPE;
PROCEDURE PROC1 (p_val IN TAB_LIST);
END PKG1;
/
create or replace PACKAGE BODY PKG1 AS
PROCEDURE PROC1 (P_VAL IN TAB_LIST
)
IS
BEGIN
FOR i IN p_val.FIRST..p_val.LAST
LOOP
insert INTO T1
(
ID , NAME
)
VALUES
(
P_VAL(I).ID,
p_val(i).NAME
);
END LOOP;
END;
END;
*****************************************
DECLARE
P_VAL DL_USER.PKG1.TAB_LIST;
BEGIN
P_VAL := PKG1.TAB_LIST(123,'XYZ');
END;
*********************************************
thanks in advance