Home » SQL & PL/SQL » Client Tools » Setting LINESIZE
Setting LINESIZE [message #438016] Wed, 06 January 2010 14:34 Go to next message
Anne Simms
Messages: 163
Registered: May 2002
Location: San Francisco, CA
Senior Member
Hi,

How do you determine or what is the proper way to set a linesize in sql*plus? I don't just want to make up a number. Any suggestions would be greatly appreciated.



Anne
Re: Setting LINESIZE [message #438018 is a reply to message #438016] Wed, 06 January 2010 14:40 Go to previous messageGo to next message
Littlefoot
Messages: 20827
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Simply, if it is too short, enlarge it.

An example:
SQL> set linesize 80
SQL> select * from emp where rownum = 1;

     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM
---------- ---------- --------- ---------- ---------- ---------- ----------
    DEPTNO
----------
      7369 SMITH      CLERK           7902 17.12.1980        800
        20


SQL> set linesize 120
SQL> /

     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ---------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17.12.1980        800                    20

SQL>

I just *look at it* and, if the output takes two lines, I enlarge its size.

[Updated on: Wed, 06 January 2010 14:42]

Report message to a moderator

Re: Setting LINESIZE [message #438019 is a reply to message #438016] Wed, 06 January 2010 14:40 Go to previous messageGo to next message
Michel Cadot
Messages: 63814
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I don't just want to make up a number.

What does this mean?

I usual set it to 120, it is not too large to be easy to read (and print) and not too small to fit almost all my scripts.

Regards
Michel
Re: Setting LINESIZE [message #438020 is a reply to message #438018] Wed, 06 January 2010 14:55 Go to previous messageGo to next message
Anne Simms
Messages: 163
Registered: May 2002
Location: San Francisco, CA
Senior Member
Thanks littlefoot that was very helpful!!!
Re: Setting LINESIZE [message #438077 is a reply to message #438019] Thu, 07 January 2010 01:14 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Michel Cadot wrote on Wed, 06 January 2010 21:40
I usual set it to 120, it is not too large to be easy to read

Huh??

What happened to the "Keep your lines at a max of 80 chars because people cannot read it otherwise"?
Re: Setting LINESIZE [message #438095 is a reply to message #438077] Thu, 07 January 2010 01:54 Go to previous messageGo to next message
Michel Cadot
Messages: 63814
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
As I said when we talked about line width, asking 80 characters let's hope that it will be under 100 or 120.
In addition, 120 characters can fit in printed page width but not in my window screen without scrolling.
And if you want to know everything, 95% of my reports fit in 80 characters width just few of them needs more. Setting it to 120, does not mean using 80 each time but prevents from line fold in case of it exceeds it.

And in the end, my remark was above all to analyze code/query (on screen), I maintain that more than 80 characters leads to move eyes/head (if not scrolling window) to read the whole code line and when you come to the end of the line, you forget the details of the beginning and have to go back and forth to understand it.

Hope this is clear now. Wink I know this was a kind dig from you but wanted to reply a little bit seriously for beginner developer. Long lines lead to codes harder to read and understand and to bugs and are more difficult to maintain.

Regards
Michel
Re: Setting LINESIZE [message #438121 is a reply to message #438077] Thu, 07 January 2010 03:43 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Laughing Point!!!

regards,
Delna
Re: Setting LINESIZE [message #438127 is a reply to message #438121] Thu, 07 January 2010 03:58 Go to previous messageGo to next message
Michel Cadot
Messages: 63814
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
So you didn't read my answer or did not understand it.

Regards
Michel

[Updated on: Thu, 07 January 2010 03:58]

Report message to a moderator

Re: Setting LINESIZE [message #438145 is a reply to message #438127] Thu, 07 January 2010 04:25 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
No sir. I was just kidding, nothing else! Razz

regards,
Delna
icon12.gif  Re: Setting LINESIZE [message #438216 is a reply to message #438016] Thu, 07 January 2010 09:47 Go to previous messageGo to next message
LKBrwn_DBA
Messages: 487
Registered: July 2003
Location: WPB, FL
Senior Member
Apart from setting the linesize to fit your report, when spooling you may want also to set: TRIMS ON to truncate (trim) the trailing spaces.

My 2c.
Smile
Re: Setting LINESIZE [message #439130 is a reply to message #438216] Thu, 14 January 2010 10:15 Go to previous messageGo to next message
Anne Simms
Messages: 163
Registered: May 2002
Location: San Francisco, CA
Senior Member
Thanks that advice helped.
Re: Setting LINESIZE [message #439131 is a reply to message #439130] Thu, 14 January 2010 10:16 Go to previous messageGo to next message
Anne Simms
Messages: 163
Registered: May 2002
Location: San Francisco, CA
Senior Member
Also what if linesize was set to 9000 and set trims on was also set.. will this still help with the trailing spaces?

In what case would a report need to be more than 120? I haven't seen this often.

Re: Setting LINESIZE [message #439133 is a reply to message #439131] Thu, 14 January 2010 10:20 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Long linesizes are used typically for results that are spooled to a file, not intended to be printed, but intended to be sent to other applications.
Trimspool always cuts back to the last non space characters.
Re: Setting LINESIZE [message #439134 is a reply to message #439131] Thu, 14 January 2010 10:23 Go to previous messageGo to next message
ThomasG
Messages: 3186
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Anne Simms wrote on Thu, 14 January 2010 17:16

In what case would a report need to be more than 120? I haven't seen this often.


Well, it would need to be wider than 120 when it needs to be wider than 120 Very Happy

I use SQL*Plus sessions thousands of columns wide quite often when I have to visually compare 2-3 table rows with hundreds of columns. There are not much cases like that for user reports, but often developers / administrators need them.

Also when you have to spool CSV files with many columns.
Re: Setting LINESIZE [message #439429 is a reply to message #438016] Sat, 16 January 2010 14:12 Go to previous messageGo to next message
Kevin Meade
Messages: 2098
Registered: December 1999
Location: Connecticut USA
Senior Member
If you are creating reports via sqlplus then you will likely be using the TTITLE and BTITLE sqlplus commands. The old style version of these command center headings based on the length of the line. Thus you pick a linesize that matches the width of your report.

If you are not generating reports via sqlplus but rather just viewing data, then most of the time SET LINESIZE 999 does the trick.

As was also noted there are several other settings of import you should consider when dumping data.

SET LINESIZE 999
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF
SET ECHO OFF
SET TIME OFF
SET TIMING OFF
SET TRIMSPOOL ON
SET TRIMOUT ON

You should check the sqlplus manual to understand what these commands do and thus how you could take advantage of them. For example, the commands above I use when dumping a CSV file quick and dirty from SQLPLUS.

Also look at these other sqlplus commands and in general review the sqlplus commands portion of the manual for other ideas that would be useful to you.

CLEAR BREAKS
COLUMN ...

Good luck, Kevin
Re: Setting LINESIZE [message #448039 is a reply to message #439429] Fri, 19 March 2010 03:03 Go to previous message
n_prabhakar
Messages: 3
Registered: March 2010
Location: Singapore
Junior Member
In addition to set lines, pls also use set pages parameter

set pages 9999

so that it helps to streamline the output

good luck
Previous Topic: Erwin tool installation / which one to install
Next Topic: Substitution Variables
Goto Forum:
  


Current Time: Fri Sep 30 12:24:44 CDT 2016

Total time taken to generate the page: 0.08416 seconds