Search code examples
oracle-databaseoracle-sqldeveloperplsqldeveloper

Not able to see the results by using Dbms_Output.Put_Line


I am not able to see the results by using Dbms_Output.Put_Line in sql developer. The result is shown only once. When I execute it again, it is not shown. I checked a lot of workarounds described in google, but those haven't worked for me.

I am executing following:

set serveroutput on;

BEGIN

 Dbms_Output.Put_Line('hello1');

END;

It should print 'hello1', everytime it executes, but instead, it does so only during first run. I have also tried the only resolution available on google: Opening the 'view' menu and clicking on 'dbms output'. I got a dbms output window at the bottom of the worksheet. I then added the connection by clicking on plus sign appearing in window. But even that did not work for me. Please can anyone help me here?


Solution

  • This version is being used at my workplace and is remotely hosted, so there is a remote possibility that they will upgrade by acting on my advice.

    For now I am able to generate output by this simple workaround: To generate the output I have to select and run all the statements(including 'set serveroutput on;') as a whole, every time I need to generate output. Note that executing 'set serveroutput on;' and

    BEGIN
    
     Dbms_Output.Put_Line('hello1');
    
    END;
    

    separately is not working. I need to select the statements at once and run together in one Go. That's the way it is working for me.