DBMS_OUTPUT and sql*plus options

Other than embedding the options as text and using run as script

Is there any way to set dbms_output and spooling options?

For instance wrapped, word wrapped, truncated, trimspool etc?

  1. could you make that idea in plain SQL*Plus?

  2. If yes, please small demo to understand better your thought

Cheers

Damir

something like these variations.

Run the following twice, once as is, and once with “set trimspool on”

SET LINESIZE 10

SET SERVEROUTPUT ON

BEGIN

DBMS_OUTPUT.put_line('When in the course of human events');

DBMS_OUTPUT.put_line('');

DBMS_OUTPUT.put_line('    When in the course of human events');

DBMS_OUTPUT.new_line;

DBMS_OUTPUT.put_line('---------------------------------------------');

END;

/

SET SERVEROUTPUT ON FORMAT WRAPPED

BEGIN

DBMS_OUTPUT.put_line('When in the course of human events');

DBMS_OUTPUT.put_line('');

DBMS_OUTPUT.put_line('    When in the course of human events');

DBMS_OUTPUT.new_line;

DBMS_OUTPUT.put_line('---------------------------------------------');

END;

/

SET SERVEROUTPUT ON FORMAT WORD_WRAPPED

BEGIN

DBMS_OUTPUT.put_line('When in the course of human events');

DBMS_OUTPUT.put_line('');

DBMS_OUTPUT.put_line('    When in the course of human events');

DBMS_OUTPUT.new_line;

DBMS_OUTPUT.put_line('---------------------------------------------');

END;

/

SET SERVEROUTPUT ON FORMAT TRUNCATED

BEGIN

DBMS_OUTPUT.put_line('When in the course of human events');

DBMS_OUTPUT.put_line('');

DBMS_OUTPUT.put_line('    When in the course of human events');

DBMS_OUTPUT.new_line;

DBMS_OUTPUT.put_line('---------------------------------------------');

END;

/

Note how the format options changes the output.

Interestingly, only the WORD_WRAPPED left justifies and removes new lines.

It would be nice to have Toad features to reproduce these options.

UI-wise I’m envisioning a drop down or radio button for the format options and a check box for trimspool on the output tab itself for easy toggling.

SQL*PLUS defaults to WORD_WRAPPED formatting but I think it would be better if Toad could save your choices

While I was specifically asking about the F9 and Shift-F9 execution rather than the F5 “Execute as Script” - it would probably be good to have the script option support this functionality too

The original question still stands - if there is a way to do this already without an enhancement, please explain.

If it can’t be done, then please consider this feature request.