Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus...automatically setting a column width?

Re: sqlplus...automatically setting a column width?

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 30 Jun 2006 10:18:23 -0800
Message-ID: <44a55cdf$1@news.victoria.tc.ca>


Mark Harrison (mh_at_pixar.com) wrote:
: I have some really wide varchar columns, but the data
: is not very long. Is there a way to automatically
: combine these two statements, to set the column width
: to the width of the longest string?

: SQL> select max(length(x2)) from foo;

: MAX(LENGTH(X2))
: ---------------
: 32

: SQL> column x2 format a32

: Many TIA!
: Mark

You could use an older version of sqlplus and then use substr() on the string within the select. The column width can be controlled that way (until about version 9.something I think).

You may not be able to use some other newer features of the database with an older sqlplus. I used sqlplus version 3.something for years, it was by far the most reliable version on windows (didn't ever crash etc), though it wouldn't describe any of the newer objects. Received on Fri Jun 30 2006 - 13:18:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US