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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Keeping number format when using Concat

Re: Keeping number format when using Concat

From: Mike Liu <mike2322_at_hotmail.com>
Date: 22 Jan 2003 13:40:44 -0800
Message-ID: <2262aa8e.0301221340.3a220baf@posting.google.com>


allanmorley_at_hotmail.com (Al) wrote in message news:<b47c6ef5.0301220327.7c36170a_at_posting.google.com>...
> Can anyone help me?
>
> I'm trying to convert the output data into a regular number format
> ie .2 -> 0.2
> 3 -> 3
> -1.3 -> -1.3
>
> As soon as I combine this with the concat function, I can't obtain
> these formats.
>
> I tried
> select to_char(-3, 'fm9990D99999') ||' text' from dual
> but this returns '-3. text' instead of '-3 text'
>
> I know there's probably an easy answer but I seem to be going round in
> circles in keeping this number format. Any help would be greatly
> appreciated!
>
> Thanks
>
> Al

There are probably some better ways. But you could try

select rtrim(to_char(-3, 'fm9990D99999'), '.') ||' text' from dual

or maybe

select rtrim(to_char(-3, 'fm9990D99999'), to_char(0, 'fmD') ) ||' text' from dual

if you need to support different decimal characters.

Regards,
Mike Received on Wed Jan 22 2003 - 15:40:44 CST

Original text of this message

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