Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to set col width in a query
Couple options.
select max(length(column_name)) from table_name;
and then select a substring of that column (assuming we're talking about a character column and not numeric) and give the column an alias to neaten things up:
select substr(column_name,1,X) "alias name" from table_name; --(where X is the longest length)
2. Just define the column's attributes before running the query and don't
do a substring:
clear columns
column column_name format aX truncated
--(where X is the desired length and 'a' means alphanumeric)
select column_name from table_name;
Any documentation on SQL*Plus reports should probably cover this type of
stuff.
--
Matt Brennan
SQL*Tools Specialist
GERS Retail Systems
9725-C Scranton Road
San Diego, California 92121
1-800-854-2263
mbrennan_at_gers.com
Joe Condle <condle_at_med.pitt.edu> wrote in article
<3534BE9B.7BB2_at_med.pitt.edu>...
> I know this is probably a newbie question. I have searched
> the documentation and can not find the answer. The question is
> how can I change the default column width in a query. The column
> widths in my database were made to large enough for the biggest
> piece of data. Most of the time thought they are alot narrower.
> I am looking for a SQL addition to the select statement that would
> allow me to vary the col widith localy in a query.
>
> Thank You
>
> Joe Condle
> Sys Engr
> Medical ARchival Systems, Inc.
> University of Pittsburgh Medical Center
Received on Wed Apr 15 1998 - 11:20:01 CDT
![]() |
![]() |