1

THIS WORKS

-- SET SERVEROUTPUT ON
 DECLARE
    v_num NUMBER := 0;
 BEGIN
    LOOP
        dbms_output.put_line(' v_num : ' || v_num);
        v_num := v_num + 1;
        EXIT WHEN v_num > 4;
    END LOOP;
 END;
--/

THIS DOESNT AND I HAVE NO IDEA WHY

 SET SERVEROUTPUT ON
 DECLARE
    v_num NUMBER := 0;
 BEGIN
    LOOP
        dbms_output.put_line(' v_num : ' || v_num);
        v_num := v_num + 1;
        EXIT WHEN v_num > 4;
    END LOOP;
 END;
 /

I WAS EXPECTING

1
2
3
4
Jon Heller
  • 34,999
  • 6
  • 74
  • 132
graycode
  • 13
  • 3
  • I don't use DBeaver. What exactly "doesn't work" mean? Is there any error? If so, that might be because DBeaver probably doesn't support SQL*Plus commands (SET is such a command). BTW, did you check this https://stackoverflow.com/questions/51520900/dbeaver-not-showing-dbms-output ? – Littlefoot Jan 26 '23 at 06:13
  • i didnt understood why u need set serveroutlet on oracle dev but not in dbeaver to use dbms_output_put_line command but someone else made me realise that sql plus is oracle commandline tool command i technically still dont understand what it does and why is needed there but not here but atleast i got part of the answer that interested me – graycode Jan 27 '23 at 07:43

1 Answers1

1

SET SERVEROUTPUT ON

Is a command of SQLPLUS (Oracles "command line tool" to access the DB)

=> It is not SQL that you send to the server. It is used on your client.

As you use a different tool, I assume this is no implemented there...

And for the specific case ( = you want to view dbms_output output) :

There is an output tab in DBeaver where the dbms_output occurs ...

enter image description here