0

DBMS output not displaying

DECLARE
COUNT1 NUMBER;


BEGIN
    SELECT COUNT(*)
    INTO COUNT1
    FROM PROCESSPART
    WHERE DIV = '1'
     AND BK = '0G'
     AND BK_YR = '19';
  DBMS_OUTPUT.PUT_LINE('PROCESSPART RECORDS IN GEN5 FOR LOC 1, BK 0G, BK_YR 2019');
  DBMS_OUTPUT.PUT_LINE(COUNT1);

  END;

I have turned DBMS Output on in SQL Developer, and the window is there, connected to the DB. But when I run the block nothing appears in the window after successful completion.

APC
  • 144,005
  • 19
  • 170
  • 281
J.C.
  • 1
  • 1
    did you turn on dbms_output in sqldeveloper? or from sqlplus - set serveroutput on – OldProgrammer Apr 30 '19 at 18:13
  • Yeah, i have it turned on and the window is there. connected to the DB but when i run the block nothing appears in the window after successful completion – J.C. Apr 30 '19 at 18:19
  • *"nothing appears in the window"* - Not saying I don't believe you, but this seems excessively unlikely. – APC Apr 30 '19 at 18:44
  • OP could be right - if they're on a newer version of SQL Developer and an older version of the DB like 10g, DBMS OUTPUT won't work due to jdbc driver compatibility issues – thatjeffsmith Apr 30 '19 at 21:33
  • 1
    I'm not sure what the counting brings to the [MCVE](https://stackoverflow.com/help/mcve). Why not just `begin dbms_output.put_line('Hello'); end;` – William Robertson Apr 30 '19 at 22:08

1 Answers1

0

Before your statements use the instruction below (as OldProgrammmer said) and run them together:

SET serveroutput ON

DECLARE
COUNT1 NUMBER;


BEGIN
    SELECT COUNT(*)
    INTO COUNT1
    FROM PROCESSPART
    WHERE DIV = '1'
     AND BK = '0G'
     AND BK_YR = '19';
  DBMS_OUTPUT.PUT_LINE('PROCESSPART RECORDS IN GEN5 FOR LOC 1, BK 0G, BK_YR 2019');
  DBMS_OUTPUT.PUT_LINE(COUNT1);

END;
jagra
  • 543
  • 2
  • 8