SQL*Plus is a PITA. Its text formatting is horrible.
Some alternatives to SQL*Plus are listed below:
However, this is not always possible for various reasons. Sometimes you are forced to use whatever bare-bones tools that are installed on a basic OS. The rest of this page deals with these bare-bones solutions.
SET PAGESIZE 50000 LINESIZE 16000 NEWPAGE 0 SPACE 0 FEED OFF HEAD OFF TRIMSPOOL ONYou can also use COLUMN formatting commands. However, you have to do this for every column in the response, so this can get quite tedious.
SELECT DBMS_XMLGEN.GETXML('SELECT * FROM TABLENAME');If you want to use single-quotes in the query, escape them by doubling them up:
SELECT DBMS_XMLGEN.GETXML('SELECT * FROM TABLENAME WHERE ID=''ABC123'' AND ROWNUM<10');To prevent line-wrapping or other formatting problems:
SET LINESIZE 32767 LONGCHUNKSIZE 99999999 LONG 99999999
Another issue: By default, dbms_xmlgen ignores columns that include a null. You can fix this by using dbms_xmlgen.setnullhandling(2)