Re: padding zero before decimal if result is less than 1

From: amonte <ax.mount_at_gmail.com>
Date: Mon, 17 Oct 2011 18:37:33 +0200
Message-ID: <CABV7K9s7iQkWP9ZE2F77OgNvC-ShT_4zdNBe63iGWLTK46V2Cg_at_mail.gmail.com>



oops
I forgot to say that this is called inside PL/SQL and invoked from .net so sqlplus specifica such as column xxx cannot be used

for example the pl/sql is like

declare

    l_var number;
begin

    l_var := 1/2;
    dbms_output.put_line(l_var);
end;
/

the returned value is passed to .net and this writes it to an excel cell, since pl/sql returns .5 when this is written to excel as number it fails!

2011/10/17 David Fitzjarrell <oratune_at_yahoo.com>

> SQL> column result format 999990.90
> SQL>
> SQL> select 1/2 result from dual;
> RESULT
> ----------
> 0.50
> SQL>
>
> David Fitzjarrell
>
>
> *From:* amonte <ax.mount_at_gmail.com>
> *To:* Oracle-L Group <oracle-l_at_freelists.org>
> *Sent:* Monday, October 17, 2011 9:12 AM
>
> *Subject:* padding zero before decimal if result is less than 1
>
> Hi
> In sqlplus when we divide if the result is less than 1, for example 0.5 we
> see this:
>
> SQL> select 1 /2 from dual;
>
> 1/2
> ----------
> .5
>
> Is it possible to get 0.5 without using to_char()?
>
> I am fine with .5 but since this has to be written to an xls excel doesnt
> like it!
>
>
> Thank you
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Oct 17 2011 - 11:37:33 CDT

Original text of this message