Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Passing out parameters through ORACLE Procedures

Posted on 2011-10-06
4
Medium Priority
?
356 Views
Last Modified: 2012-05-12
Greetings,
I have three stored procedures in ORACLE

 
--PARENT PROCEDURE
procedure TRANSCRIPT REPORT (pBSA in NUMBER, FRM_ID in NUMBER, TRANSCRIPT_CURSOR in OUT TRANSCRIPTS.TRANSCRIPTSOUTPUT)

CASE WHEN FRM_ID=1 THEN EXECUTE SAR_TRANSCRIPT(BSA, #TRANSCRIPT_CURSOR) END
CASE WHEN FRM_ID=2 THEN EXECUTE RMSB_TRANSCRIPT(BSA, #TRANSCRIPT_CURSOR) END

END PROCEDURE

--SAR_TRANSCRIPT
procedure SAR_TRANSCRIPT (pBSA in NUMBER, TRANSCRIPT_CURSOR in OUT TRANSCRIPTS.TRANSCRIPTSOUTPUT)

   open TRANSCRIPT_CURSOR for --need to uncomment this for SP
        select (...) FROM (...);

END PROCEDURE

--RMSB_TRANSCRIPT
procedure RMSB_TRANSCRIPT (pBSA in NUMBER, TRANSCRIPT_CURSOR in OUT TRANSCRIPTS.TRANSCRIPTSOUTPUT)

   open TRANSCRIPT_CURSOR for --need to uncomment this for SP
        select (...) FROM (...);

END PROCEDURE

Open in new window


I need to call one of the sub-procedures from the parent procedure, and then take the ref_cursor output of the sub-procedure and make that the output of the parent procedure.

Assume the ref_curser is called TRANSCRIPTS.TRANSCRIPTSOUTPUT

Thanks
0
Comment
Question by:Evan Cutler
  • 2
  • 2
4 Comments
 
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 36926270
What problems are you having?

I'm not following your code stubs but below is a test case that shows what I think you want (tested using sqlplus).
create or replace procedure child(outCur in out sys_refcursor)
is
begin
	open outCur for 'select sysdate from dual';
end;
/

show errors

create or replace procedure parent(outCur in out sys_refcursor)
is
begin
	child(outCur);
end;
/

show errors

var cur1 refcursor
exec parent(:cur1);

print cur1

Open in new window

0
 
LVL 9

Author Comment

by:Evan Cutler
ID: 36926363
Ok,
how do you put child(outCur) into the parent procedures outCur out variable?
0
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 36926385
It does it automatically with the 'in out' declaration.
0
 
LVL 9

Author Closing Comment

by:Evan Cutler
ID: 36927579
AWESOME...
Thanks much my friend...

See you around the EE.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question