Toad World® Forums

Display RefCursor in Toad 13


#1

Just like this question: Display results Stored procedure resturns SYS_REFCUR.

However, in Toad 12, it would bring up the results grid without any double-clicking on the word (CURSOR). And therefore, I could run the procedure with different parameters, and then go back and forth between the results. I THOUGHT that worked for me last week, after I’d upgraded to Toad 13. It doesn’t now. Now I get a free-floating box that has to be dismissed before I can get back to my Toad instance, after double-clicking on the word and waiting for my results.

Since it worked better in 12 (better than the answer to the linked question), that must still be there. I just can’t find it. How do I get the results grid directly, and in a pinned window within the application?


#2

You can obtain your cursor in an anonymous block and assign it to a bind variable. When you execute Toad will prompt for the variable’s type/value. Set its type to Cursor and click OK. Results will show in the normal Data Grid.

Example function:

CREATE OR REPLACE FUNCTION return_cur
    RETURN SYS_REFCURSOR
AS
    cur   SYS_REFCURSOR;
BEGIN
    OPEN cur FOR SELECT * FROM user_tables;

    RETURN cur;
END;

Example call…

BEGIN
    :cur := return_cur;
END;

When prompted, set Type to cursor…

image

Results shown in the grid…

image


#3

It took me a minute to remember what the change was and looking back at Toad 12 you are correct, cursors did show in their own grid by default when executing PL/SQL. In older Toad your only option for getting out/return values (excluding cursors) was to use DBMS output. The change was made to consolidate all output to a common area in a non-plain text format and support newer features like creation of unit tests from PL/SQL execution results.