Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

stored procedures - Oracle SQL Developer: Show REFCURSOR Results in Grid?

As a follow-up to the question "Get resultset from oracle stored procedure", is there a way to show the results of a stored procedure that returns a REFCURSOR in a grid (instead of the plain text Script Output window) within SQL Developer?

EDIT: The answer helped, but I'm still having a problem displaying the result set in the "View Value" window:

alt text

The columns can only be expanded a small amount, probably due to the number of results being returned. Expanding the window with the resizer control doesn't help:

alt text

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I don't think you can with a procedure.

Edit: Thanks to DCookie for simplifying my original answer.

But as a work-around you can write a function that calls the procedure and then invoke that using SQL.

e.g.

create or replace function callmyproc
return sys_refcursor
IS
   rc   sys_refcursor;
BEGIN

   myproc(rc);

   return rc;

END;

Which you can then call with:

   select callmyproc()
   from dual;

When this example is run, the SQL Developer data grid shows one result but if you scroll right and click on the edit button, you will see the results in a grid.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...