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 formatting quesion re: TO_CHAR()

SQL formatting quesion re: TO_CHAR()

From: <lewandow_at_uwm.edu>
Date: Wed, 16 Sep 1998 19:28:55 GMT
Message-ID: <6tp3hn$mvs$1@nnrp1.dejanews.com>

I have a special problem here in the school system.

The Big Bad State Education Office wants a report (1290) that looks like this: 9003091F000120003 ^ ^ ^^^ ^ ^ (record type '9')/(filler
'003')/(grade '09')/(race code '1')/(gender 'F')/(number of records
'00012')/(school number '0003')

But I get this output:

9 003091F 00012 0003

when I use the following SQL script:



SPOOL 1290OUT.TXT
SET HEADING OFF
SELECT
	'9'||
        to_char(T.SCH_CD, '000')||
	T.GRD_LVL||
        Student.ETHNC_CD||
	Student.GENDER_CD||
        to_char(COUNT(T.SDNT_ID), '00000')||
	to_char(T.SCH_CD, '0000')
FROM
	Student, Thrd_Fri_Enrl T, WAREHS.Thrd_Fri_Dates
WHERE (T.SCH_CD in ('033', '032')
AND T.SDNT_ID=Student.SDNT_ID
AND Thrd_Fri_Dates.THRD_FRI_DT=T.THRD_FRI_DT) GROUP BY T.SCH_CD, T.GRD_LVL,
       Student.ETHNC_CD, Student.GENDER_CD; SPOOL OFF
SET HEADING ON
/

It appears the TO_CHAR formatting statement automatically inserts a space before the value, even if you try using concatenation. Any way around this?

Thanks in advance,

Kent
--
Kent Lewandowski
lewandow_at_uwm.edu
Intern, Graduate Assistant
Milwaukee Public Schools

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Wed Sep 16 1998 - 14:28:55 CDT

Original text of this message

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