Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

calling a proc in pl/sql which has out parameter as cursor.

Matthew_LeeFeb 1 2012 — edited Feb 1 2012
I have a pkg and proc in the body.
The in paramerter to proc in table type and out parameter is cursor.
I am calling the proc from a pl/sql block and I am not able to print the cursor result of proc in the pl/sql block.
How can i achieve this ?


CREATE OR REPLACE PACKAGE TEST_PKG
IS
TYPE emp_tab is table of emp.empno%type index by pls_integer;
TYPE RC IS REF CURSOR;
PROcedure test_proc (tab in emp_tab,curout in out rc);
END;
/
create or replace package BODY test_pkg as
procedure test_proc (tab in emp_tab,curout in out rc) IS
begin
DBMS_OUTPUT.PUT_LINE('entry 1 is [' || tab(1) || ']');
OPEN curout FOR
SELECT DISTINCT .... from table;
end;
end;
/

Say above is the code and while trying to run the below Pl/SQL I want to see the cursor result, how do i see it ?
DECLARE
tab_test TEST_PKG.emp_tab;
cursoroutput TEST_PKG.RC
begin
TAB_TEST(1) := 20;
TEST_PKG.test_proc(tab_test,cursoroutput);
-- DBMS_OUTPUT.PUT_LINE( cursoroutput); didn't work
end;

Thanks and appreciate for the help

Thanks
/
This post has been answered by Boneist on Feb 1 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 29 2012
Added on Feb 1 2012
4 comments
255 views