Oracle stored procedure that returns records

1

I am doing a stored procedure on the HR data base in pl / sql which returns me records.

CREATE OR REPLACE 
PROCEDURE HR.Mostrar_Paises (continente NUMBER)
IS
  v_rut  VARCHAR(100);
BEGIN
  for c in(Select Country_Name into v_rut from HR.COUNTRIES where region_id=continente)
  loop v_rut:=c.Country_name;
  DBMS_OUTPUT.PUT_LINE(v_rut);
  end loop;
END;

I execute the stored procedure:

BEGIN 
  HR.Mostrar_Paises(2);
COMMIT;
END;

And he does not show me the result, only this message comes to me:

  

PL / SQL procedure terminated correctly.

I would like to know why you do not show me the result.

    
asked by Freddy 12.12.2016 в 00:57
source

1 answer

0

So that you can see the messages coming from calls to DBMS_OUTPUT.PUT_LINE , you must execute the following statement before executing the PL / SQL block:

set serveroutput on

So you can run the script this way:

set serveroutput on

begin
  HR.Mostrar_Paises(2);
end;

You will notice that I removed the COMMIT; , simply because I do not see that you are modifying data, but that change is not pertinent to your question.

    
answered by 12.12.2016 / 01:08
source