Tuesday, February 21, 2017

PASSING COLLECTION OBJECTS AS A INPUT PARAMETER

CREATE OR REPLACE PACKAGE SIDDHARTH_TEST AS
PROCEDURE MAIN_TEST( ERRBUF  OUT VARCHAR2,RETCODE OUT NUMBER);
END SIDDHARTH_TEST;
/

CREATE OR REPLACE PACKAGE BODY SIDDHARTH_TEST AS 
TYPE T1 IS TABLE OF SIDDHARTH%ROWTYPE INDEX BY BINARY_INTEGER;
V1 T1;
I NUMBER(10):=0;
CURSOR C1 IS SELECT * FROM SIDDHARTH WHERE ID=30;
PROCEDURE P1_TEST (RET IN C1%ROWTYPE) IS
BEGIN
fnd_file.put_line(fnd_file.LOG,'CHECK4');
I:=I+1;
V1(I).NAME:=RET.NAME;
V1(I).ID:=RET.ID;
fnd_file.put_line(fnd_file.LOG,'CHECK7');
dbms_output.put_line(V1(I).NAME||V1(I).ID);
END P1_TEST;
FUNCTION F1_TEST(PEC IN T1) RETURN NUMBER AS
Q NUMBER(10);
BEGIN
fnd_file.put_line(fnd_file.LOG,'CHECK5');
For I in PEC.first..PEC.last LOOP
fnd_file.put_line(fnd_file.LOG,'CHECK6');
SELECT ID INTO Q FROM SIDDHARTH WHERE NAME=(PEC(I).NAME);
RETURN (Q);
END LOOP;
END F1_TEST;
PROCEDURE MAIN_TEST(ERRBUF  OUT VARCHAR2,RETCODE OUT NUMBER) IS
P NUMBER(10);
BEGIN
fnd_file.put_line(fnd_file.LOG,'CHECK1');
FOR REC IN C1 LOOP
fnd_file.put_line(fnd_file.LOG,'CHECK2');
P1_TEST(REC);
P:=F1_TEST(V1);
fnd_file.put_line(fnd_file.LOG,P);
END LOOP;
fnd_file.put_line(fnd_file.LOG,'CHECK3');
END MAIN_TEST;
END SIDDHARTH_TEST;
/


No comments:

Post a Comment