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: Valentin Minzatu <valentinminzatu_at_yahoo.com>
Date: Tue, 05 Jun 2007 15:31:05 -0000
Message-ID: <1181057465.875087.194720@r19g2000prf.googlegroups.com>


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? Received on Tue Jun 05 2007 - 10:31:05 CDT

Original text of this message

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