Reputation: 11
I am trying to print server output in SQLcl through the ScriptRunnerContext class. I have an SQL file that does not have SET SERVEROUTPUT ON, but it contains DBMS_OUTPUT statements. Is there any way to handle this through the ScriptRunnerContext class? I found a property, but it is not working as expected:
sqlcli.getScriptRunnerContext().getProperties().put(ScriptRunnerContext.SHOWSERVEROUTPUT, true);
sqlcli.run();
However, this ScriptRunnerContext.SHOWSERVEROUTPUT has no effect on the output.
I want to print the server output and spool files for my SQL file (student.sql), but this file does not have the SET SERVEROUTPUT ON, SPOOL filename, and SPOOL OFF commands. I want to handle this with:
sqlcl.getScriptRunnerContext().getProperties().put(ScriptRunnerContext.SPOOLOUTBUFFER, true);
sqlcl.getScriptRunnerContext().getProperties().put(ScriptRunnerContext.SPOOLOUTFILENAME, "D:\\sqltest\student-test");
sqlcl.getScriptRunnerContext().getProperties().put(ScriptRunnerContext.SHOWSERVEROUTPUT, false);
Upvotes: 1
Views: 90