DBMS_OUTPUT.PUT_LINE does not work with cursors

0

If I execute this line, it perfectly shows the output of the DBMS
BEGIN DBMS_OUTPUT.PUT_LINE('HOLA'); END;

but when executing this process

DECLARE CURSOR mayor_valor IS SELECT nombre, descripcion FROM producto WHERE precio = (SELECT MAX(precio) FROM producto); BEGIN FOR maximo IN mayor_valor LOOP DBMS_OUTPUT.PUT_LINE('Producto con mayor precio: ' ||maximo.nombre); DBMS_OUTPUT.PUT_LINE('Descripcion: ' || maximo.descripcion); END LOOP; END;

I only get it

PL / SQL procedure terminated correctly.

This block worked perfectly in a computer room of the university, but not here in my house. I also have another file that contains a package with 2 procedures, and when executing these, the output of the DBMS works perfectly.

    
asked by Julian muñoz 08.05.2016 в 04:42
source

2 answers

0

If you are with SQL Developer you have to activate the DBMS output that is in the view menu.

Then you have to establish a connection with the ORACLE server, (Just as you do to establish a connection to the database by pressing the + button) then you will have something like this:

I hope it serves you

    
answered by 28.06.2016 / 12:59
source
0

The code you are showing is correct, however you do not indicate if you are running it from a console or from an IDE such as Toad, Navigator.

If you are using TOAD on the DBMS Output tab you will see all results

    
answered by 11.05.2016 в 16:03