30

I've tried this, but it doesn't work:

col * format a20000

Do I really have to list every column specifically? That is a huge pain in the arse.

cagcowboy
  • 30,012
  • 11
  • 69
  • 93
someguy
  • 1,923
  • 5
  • 21
  • 19

4 Answers4

41

Never mind, figured it out:

set wrap off
set linesize 3000 -- (or to a sufficiently large value to hold your results page)

Which I found by:

show all

And looking for some option that seemed relevant.

user123444555621
  • 148,182
  • 27
  • 114
  • 126
someguy
  • 1,923
  • 5
  • 21
  • 19
25

I use a generic query I call "dump" (why? I don't know) that looks like this:

SET NEWPAGE NONE
SET PAGESIZE 0
SET SPACE 0
SET LINESIZE 16000
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET TERMOUT OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
SET COLSEP |

spool &1..txt

@@&1

spool off
exit

I then call SQL*Plus passing the actual SQL script I want to run as an argument:

sqlplus -S user/password@database @dump.sql my_real_query.sql

The result is written to a file

my_real_query.sql.txt

.

Patrick Cuff
  • 28,540
  • 12
  • 67
  • 94
  • To include the column header I'm using the following setting for PAGESIZE -> `SET PAGESIZE 0 EMBEDDED ON` – Soundlink Oct 10 '13 at 14:06
0
set WRAP OFF
set PAGESIZE 0

Try using those settings.

0
set linesize 3000

set wrap off

set termout off

set pagesize 0 embedded on

set trimspool on

Try with all above values.

sid8491
  • 6,622
  • 6
  • 38
  • 64
Aziz Zoaib
  • 661
  • 8
  • 21