It is really annoying that when I run a select command in SQL*Plus such as:
SELECT * FROM books;
The output is really badly formatted and unreadable (row cells are not in a row but separated by line breaks etc):
How can I configure it to show SELECT results in a nicer way?
EDIT:
This is my login.sql file contents:
SET ECHO OFF SET SERVEROUTPUT ON SIZE 1000000 SET PAGESIZE 999 SET LINESIZE 132
EDIT2:
Affer increasing the LINESIZE:
SET LINESIZE 32000
It now looks like this:
The formatting commands include: BREAK – Set the formatting behavior for records that have the same values for some columns. BTITLE – Place a title on the bottom of each page in the printout from a SQL statement. COLUMN – Change the appearance of an output column from a query.
SQL*Plus is a command-line tool that provides access to the Oracle RDBMS. SQL*Plus enables you to: Enter SQL*Plus commands to configure the SQL*Plus environment. Startup and shutdown an Oracle database.
SQL*Plus is an Oracle-developed tool that allows you to interactively enter and execute SQL commands and PL/SQL blocks. Because these three products all have “SQL” as part of their names, people occasionally get confused about the relationship between them and about which commands get executed where.
The Clear command clears the screen of the SQL*Plus application window and the screen buffer. Shift+Del is the keyboard shortcut for the Clear command.
Increase the linesize, e.g SET LINESIZE 32000
or use SET WRAP OFF
(but this will truncate long values)
SQLPlus is a simple command line tool. It's not really intended for pretty reporting. However, it does have some formatting commands, which are documented in the SQLPlus User's Guide. Find out more.
For instance you might choose to format the TITLE column to display only the first twenty characters and display the SUMMARY column in its entirety like this:
COLUMN title FORMAT a20 TRUNCATED COLUMN summary FORMAT a4o WORD_WRAPPED
This will allow you to see your query laid out more neatly without embedding formatting commands in its projection.
Alternatively, use an IDE such as Quest's TOAD or Oracle's own SQL Developer. These tools include a query browser which automagically displays our query results in a more pleasing grid. (Other similar tools are available).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With