Home » RDBMS Server » Server Utilities » formating sql output
formating sql output [message #368400] Wed, 13 December 2000 10:28 Go to next message
TLT
Messages: 2
Registered: December 2000
Junior Member
Below is the result set from a sql query:

ID TYPE
---------- ----------
NAME
------------------------------------------

41228 41225
Guests

My question is how can I get the data to show directly below the column heading. I'm dealing with very large varchar2 columns and it is very difficult to see what variables belong to the column headings. I know there is a command to remedy this, but I can't remember what it is.

Thanks
Re: formating sql output [message #368401 is a reply to message #368400] Wed, 13 December 2000 11:15 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi,

You can set the line size to a large number and spool the output to a file.
from sqlplus
SQL> set line size 150
SQL> spool c:\spool.txt
SQL> select.......
SQL> spool off

or you can use substr function to restrict the length of each column in the display

like
SQL> select substr(ID, 1, 10) ID, substr(TYPE, 1, 5) type .....etc
Re: formating sql output [message #368407 is a reply to message #368401] Thu, 14 December 2000 13:41 Go to previous message
Jan G
Messages: 6
Registered: December 2000
Junior Member
You can also format each column, e.g.
column NAME format a20
Previous Topic: importing data from excel to oracle tabel???
Next Topic: Re: SQLLDR..Load 3rd or 4th field in CSV file
Goto Forum:
  


Current Time: Sat Apr 20 07:25:32 CDT 2024