I am using PL/SQL Developer and i have written a procedure to run a report and i need to procedure to output the resultset.
The procedure accepts input parameters and needs to output the resultset.
I cannot use a view because the procedure calls several APIs which accept the parameters i am passing into the procedure.
I understand from alot of searching that it's possible using ref_cursor but i cannot get ti to work.
A simplified version of the procedure is:
CREATE OR REPLACE PROCEDURE IFSINFO.SHORTAGE_SHEET (vSite IN VARCHAR2,
vBuyer IN VARCHAR2,
vSupplier IN VARCHAR2,
vCursor OUT SYS_REFCURSOR)
AS
BEGIN
OPEN vCursor FOR
SELECT blah blah blah blah blah blah;
END;
I have tried to execture the procedure and display the resultset using:
BEGIN
vsite := 'S03';
vbuyer := 'AW';
vsupplier := '%';
vcursor refcursor;
IFSINFO.SHORTAGE_SHEET(vsite => :vsite,
vbuyer => :vbuyer,
vsupplier => :vsupplier,
vcursor => :vcursor);
print vcursor;
END;
And also:
variable rc refcursor;
exec IFSINFO.SHORTAGE_SHEET('S03','AW','TQ1',:rc2);
print rc2
But neither work. please can someone advise i am at my wits end.
Thank you Rob