2

I know it's a simple thing but I can't seem to find a solution, how do I enable dbms_output in PL/SQL Developer. From googling all I got was how to enable it in sql developer but thats not what I'm looking for... I thought it should be automatically enabled in PL/SQL Developer but for example this block outputs nothing for me.

declare
  v_sample employees.first_name%type;
begin
  select first_name 
  into v_sample
  from employees
  where employee_id = 100;

  dbms_output.put_line(v_sample);
end;
5
  • 4
    just issue SET SERVEROUTPUT ON at the beginning of your code(from the command line). Alternatively DBMS_OUTPUT.ENABLE() might be used also. (Have a look at the Output tab) Commented Dec 14, 2020 at 19:20
  • thanks for answer but I'm getting ORA-00922 missing or invalid option error on SERVEROUTPUT. Do you have idea why is it so? Commented Dec 14, 2020 at 19:30
  • that case is not used within SQL Window, but from the command line. Get rid of that and look at the Output tab please( or DBMS Output of Test window ). Do you see the result of the select statement ? Commented Dec 14, 2020 at 19:33
  • Ok, my bad. It does work in command line. Thanks Commented Dec 14, 2020 at 19:36
  • 1
    you're welcome. Have a nice study. Commented Dec 14, 2020 at 19:37

1 Answer 1

3

By default, PL/SQL Developer automatically retrieves DBMS_OUTPUT and you don't have to do anything extra to retrieve it. You do not need to use a Command Window to see output. (And you should generally avoid the Command Window - it's a terrible way to program.)

Go to Configure --> Preferences --> Oracle --> Output, and ensure that the "Enabled" button is checked: enter image description here

Another possibility is that the FIRST_NAME value is null and there is nothing to output. To avoid that confusion, I typically add a hard-coded value before outputting variables:

dbms_output.put_line('Name: ' || v_sample);
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.