Hi,
we are running procedure mentioned below,
CREATE OR REPLACE PROCEDURE rec_test (p_party_number IN VARCHAR2,
records IN test_TBL_TYPE,
x_return_status OUT VARCHAR2,
x_return_msg OUT VARCHAR2)
IS
p_distributor_flag VARCHAR2 (1) := 'N';
p_action VARCHAR2 (10);
p_view_only_permit VARCHAR2 (1);
p_demo_permit VARCHAR2 (1);
p_account_num VARCHAR2 (40);
BEGIN
FOR i IN 1 .. records.COUNT
LOOP
p_party_num := records (i).party_num;
p_action := records (i).act;
p_view_only_permit := records (i).view_only;
p_demo_permit := records (i).demo;
xxtest_pkg.test_prc (p_number,
p_party_num,
p_per_party_num,
p_dist_flag,
p_act,
x_return_status,
x_return_msg);
EXIT WHEN x_return_status = 'E';
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
x_return_status := 'E';
x_return_msg := SQLERRM;
END;
/
---anonymous block---------
DECLARE
-- Declarations
var_P_PARTY_NUMBER VARCHAR2 (32767);
var_V1 test_TBL_TYPE ;
var_X_RETURN_STATUS VARCHAR2 (32767);
var_X_RETURN_MSG VARCHAR2 (32767);
BEGIN
-- Initialization
var_P_PARTY_NUMBER := 1234567;
var_V1 := ?
-- Call
xxtest_pkg.test_prc (p_number,
p_party_num,
p_per_party_num,
p_dist_flag,
p_act,
x_return_status,
x_return_msg);
-- Transaction Control
COMMIT;
-- Output values, do not modify
:5 := var_X_RETURN_STATUS;
:6 := var_X_RETURN_MSG;
DBMS_OUTPUT.put_line ('Status: ' || var_X_RETURN_STATUS);
DBMS_OUTPUT.put_line ('Message: ' || var_X_RETURN_MSG);
END;
Need to know that how to pass tale type values in var_V1 variable,so I can run anonymous block successfully.
Right now I am getting ORA-06531: Reference to uninitialized collection error.
Please suggest.
Thanks.
Definition of test_tbl_type:
CREATE OR REPLACE TYPE test_tbl_type
IS TABLE OF test_rec_type;
/
CREATE OR REPLACE TYPE test_rec_type as object
(
party_num VARCHAR2 (40),
act VARCHAR2 (10),
view_only VARCHAR2 (1),
demo VARCHAR2 (1)
);
/
You initialize it as a test_tbl_type with however many test_rec_types you need inside it:
CREATE OR REPLACE TYPE test_rec_type as object
(
party_num VARCHAR2 (40),
act VARCHAR2 (10),
view_only VARCHAR2 (1),
demo VARCHAR2 (1)
);
/
CREATE OR REPLACE TYPE test_tbl_type
IS TABLE OF test_rec_type;
/
declare
v test_tbl_type;
begin
v := test_tbl_type (
test_rec_type('a', 'b', 'c', 'd'),
test_rec_type('a', 'b', 'c', 'd')
);
dbms_output.put_line(v(1).party_num);
end;
/
PL/SQL procedure successfully completed.
a