Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see refcursor result/output in Oracle SQL Developer? [duplicate]

Possible Duplicate:
Best way/tool to get the results from an oracle package procedure
Oracle SQL Developer: Show REFCURSOR Results in Grid?

I am new to Oracle SQL Developer. I am using Oracle SQL Developer Version 3.0. I was trying to test my SP using the following query.

DECLARE
  type output_cursor is ref cursor;
  P_CURSOR output_cursor;
BEGIN
  P_CURSOR := NULL;
  myPackage.mySPTest (  P_NOTIFICATION_ID => 1975357,P_CURSOR => P_CURSOR) ;
END;

When I ran the above query in my Oracle SQL Developer, I am getting a message 'anonymus block completed' and its not showing any result.

Can anyone help me, how to see the result.

.

like image 300
Prabin Yovan Avatar asked Dec 22 '11 22:12

Prabin Yovan


People also ask

How do I see query results in SQL Developer?

You can toggle a setting to "Show query results in new tabs" under Tools -> Preferences... -> Database -> Worksheet, so if you have all queries highlighted and Click F9 (Run), then each query result appears in a new grid tab.


1 Answers

You can use a bind variable declared in SQL Developer to hold and show the results:

var r refcursor;
exec myPackage.mySPTest(P_NOTIFICATION_ID => 1975357, P_CURSOR => :r);
print r;

exec is shorthand for an anonymous block so this is equivalent to:

var r refcursor;
begin
    myPackage.mySPTest(P_NOTIFICATION_ID => 1975357, P_CURSOR => :r);
end;
/
print r;

Unless P_CURSOR is declared as something unhelpful, maybe...

like image 102
Alex Poole Avatar answered Oct 06 '22 01:10

Alex Poole