user13399788
user13399788

Reputation:

Executing vs Compiling a stored procedure

Hello I have some problems with dbms_output. I wrote this code and dbms output in SQL Developer doesn't work.

create or replace procedure imprimirNotEmpleat(no_nom varchar2)
as
  nom varchar2(30);
  cursor buscarnom is select nom_emp 
                      from empleats 
                      where nom_emp!=no_nom;
begin
  open buscarnom;
  fetch buscarnom into nom;
  while buscarnom%found loop
    dbms_output.put_line('Empleat: '||nom);
    fetch buscarnom INTO nom;
  end loop;
  close buscarnom;
end;

Upvotes: 0

Views: 260

Answers (1)

Littlefoot
Littlefoot

Reputation: 142958

You created the procedure, but never executed it. It just waits in the database.

But, before executing the procedure, run

set serveroutput on

in SQL Developer to enable output, and then

begin
  imprimirNotEmpleat('ABC');   --> or whichever value it is
end;
/

Note that you won't see anything if cursor doesn't return any rows.

Upvotes: 1

Related Questions