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: <fitzjarrell_at_cox.net>
Date: Tue, 05 Jun 2007 11:57:04 -0700
Message-ID: <1181069824.217222.71220@p47g2000hsd.googlegroups.com>


On Jun 5, 11:43 am, EdStevens <quetico_..._at_yahoo.com> wrote:
> 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- Hide quoted text -
>
> - Show quoted text -

You cannot, of course, know both the question AND the answer lest the universe morph into something unknown and uncontrollable ... :)

David Fitzjarrell Received on Tue Jun 05 2007 - 13:57:04 CDT

Original text of this message

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