I have a stored procedure with 1 VARCHAR IN and 1 OUT SYS_REFCURSOR Parameter like below :
PROCEDURE do_stg(inParam IN VARCHAR2 := NULL, cur OUT SYS_REFCURSOR)
AS
BEGIN
OPEN cur FOR
WITH a AS
( SELECT * FROM aaa WHERE ccc = inParam),
b as
(SELECT * FROM bbb)
SELECT a.xField, b.yField
END do_stg;
Before I make some changes to the Stored Procedure, I want to test the changes in an Oracle SQL Developer Worksheet (there are some reasons why I can't change the Procedure directly) to see the results.
I have done this :
DECLARE inParam VARCHAR(50)
BEGIN
WITH a AS
( SELECT * FROM aaa WHERE ccc = inParam),
b as
(SELECT * FROM bbb)
SELECT a.xField, b.yField
END;
I am expecting to see the result in a grid view as Sproc returns a cursor, but I can't, what I am missing here?
EDIT : My question might be similar, but the answer for my question is not the same with the answer on associated question ; PL/SQL print out ref cursor returned by a stored procedure
as mentioned. For the accepted answer on that question, you have to define all the return types for the cursor TYPE MyRec IS RECORD (col1 VARCHAR2(10), col2 VARCHAR2(20), ...); --define the record
, here not.