Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting output of queries in SQLPlus

I'm working with SQLPlus at the moment and whenever I query the Database, the result is in a complete mess. In other words, it is hard to read. I wonder if anyone knows how to format the output of queries ( columns, tables.. etc) in SQLPlus that is running on Unix server. But, I am accessing the server from my windows.

And, Could anyone tell me where I can get SQLPlus for Ubuntu from?

Cheers,

like image 205
rotten69 Avatar asked Oct 13 '11 09:10

rotten69


1 Answers

Okay, start with this in SQL Plus:

SET LINESIZE 20000 TRIM ON TRIMSPOOL ON
SPOOL output.txt

-- run your queries here

SPOOL OFF
EXIT

Also, René Nyffenegger has a whole section dedicated to Beautifying SQL*Plus Output and additional resources on SQL*Plus.

like image 189
Benoit Avatar answered Sep 28 '22 08:09

Benoit