Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus...automatically setting a column width?
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