0

I am a little bit surprised when I compile and run procedure from the

enter image description here

green button as shown in pic1, I get the output from the output variable.

Here is my simple code:

CREATE OR REPLACE PROCEDURE RUNPROCEDURE
    (P_para1  in EMP.ID%type,P_PARA out SYS_REFCURSOR) 
AS 
BEGIN
    OPEN P_PARA FOR
       SELECT * 
       FROM emp 
       WHERE ID = P_para1;
END RUNPROCEDURE;

But when the same I run from the query browser, I did not see any output :=

set serveroutput on;
declare P_PARA1 number;
    P_PARA SYS_REFCURSOR;
begin
    RUNPROCEDURE(
        P_PARA1 => 2,
        P_PARA => P_PARA
    ) ;
end;
/

It just displays

PL/SQL procedure successfully complete

and I don't see any output.

Any help appreciated.

1
  • Have a look at this, perhaps of some help. Commented Jun 11, 2017 at 13:12

1 Answer 1

5

The only output from this procedure is an output parameter cursor. SQL Developer provides a method of iterating this cursor semi-automatically, while SQL*Plus doesn't - but your procedure doesn't "return" those rows, it returns the cursor. Somewhere there has to be code to iterate through the cursor, fetch the rows, and display the content of those rows.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.