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 -> sql*Plus formatting question

sql*Plus formatting question

From: EdStevens <quetico_man_at_yahoo.com>
Date: Tue, 05 Jun 2007 08:27:41 -0700
Message-ID: <1181057261.750584.182600@q19g2000prn.googlegroups.com>


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. Received on Tue Jun 05 2007 - 10:27:41 CDT

Original text of this message

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