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

Home -> Community -> Usenet -> c.d.o.server -> Re: sql*Plus formatting question

Re: sql*Plus formatting question

From: EdStevens <quetico_man_at_yahoo.com>
Date: Tue, 05 Jun 2007 09:43:36 -0700
Message-ID: <1181061816.814838.272070@j4g2000prf.googlegroups.com>


On Jun 5, 10:31 am, Valentin Minzatu <valentinminz..._at_yahoo.com> wrote:
> On Jun 5, 11:27 am, EdStevens <quetico_..._at_yahoo.com> wrote:
>
>
>
> > Platform: Oracle EE 10.2 on HPUX
>
> > Given this snippet of code:
>
> > set pages 999
> > set lines 512
> > set trimspool on
> > --
> > spo plus.log
> > --
> > select name "Name",
> > owe||to_number(grade) "Grade",
> > from ...
>
> > where owe is varchar2(1)
> > grade is varchar2(3)
>
> > and grade is actually a 2-digit number, all of which are in the range
> > '01' to '09'
>
> > When I run the query, the length of the 'Grade' column comes out to 41
> > characters, left justified. I've tried bracketing the results ('['||
> > owe||to_number(grade)||']') to see if I'm getting a bunch of leading
> > or trailing spaces, but that has shown that the data returned is
> > exactly the expected two characters. Have tried enclosing the
> > to_number inside a to_char (since I'm concatenating the results to a
> > varchar), but to no effect. If I don't concatenate owe and grade
> > (selecting them as two separate columns) there is no problem.
>
> Have you tried: col "Grade" format a3?

Which, of course, works -- but begs the question of why it is needed in this instance. ;-0 Received on Tue Jun 05 2007 - 11:43:36 CDT

Original text of this message

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