Formatting oracle output in sqlplus

DB Scripts
Page dimensionsThe defaults in sqlplus are 14 rows x 80-chars.
To change to, eg, 60 rows x 132-chars, use:

set PAGESIZE 60;
set LINESIZE 132;
Column widths

If your output has a column ‘Location’ that is too wide for your purposes, you can assign it a format via:

column Location format A20;

To list your current column formats:

column;

To clear your current column formats:

clear columns;

To clear one specific column format:

column Location clear;
CSV files

One way to create comma-separated or tab-separated files is to spool them from within sqlplus.
First set up neutral formatting:

SET PAGESIZE 0
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET MARKUP HTML OFF SPOOL OFF
SET COLSEP ','

Then

spool /tmp/output.csv
SELECT ...
spool off