Re: [q]: How to format a SQL output ?

From: dan merryman <dan.l.merryman_at_bangate1.tek.com>
Date: 1996/11/10
Message-ID: <32862C49.9B6_at_bangate1.tek.com>#1/1


John Verhoeven wrote:
>
> In article dated 5 Nov 1996 09:55:54 GMT, crosby (crosby_at_po.pacific.net.sg) wrote:
> > Before issuing your SQL statement, enter the following line in SQL*Plus
> > column name format a20
> >
> > Now execute the following query
> >
> > select name
> > from emp
> >
> > This will ensure only the first 20 characters are displayed.
>
> Nope sorry. This just limits the output column width to 20 characters.
> If the column actually has 25 characters you will get output like this:
>
> COLUMN
> --------------------
> this output causes t
> he result to wrap
>
> What you need to do is
> select substr(column,1,20) from table
>
> This will only give you the first 20 characters.
>
> --
> _--_|\ John Verhoeven Unix / Database Administrator Westrail
> / \ johnv_at_DIALix.oz.au / jverhoeven_at_westrail.wa.gov.au
> *_.--._/
> v "Smile! things could be worse... So I did... and they were..."

or

col name form a20 trunc

This will truncate the output to the first 20 chars and avoid wrapping.



Opinions expressed do not necessarily reflect those of my employer
Received on Sun Nov 10 1996 - 00:00:00 CET

Original text of this message