Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

number format (.5 instead of 0.5)

605 views
Skip to first unread message

Tino Korth

unread,
Sep 24, 2002, 5:08:44 AM9/24/02
to
Hello,

I've got a float field with the value ".5" (I've insertet a "0.5"-value,
but Oracle formats the value to ".5").
How can I "re"format the float when I'm SELECTing this value? I wanna
have "0.5" as a return value.


Greetings from Rostock, Germany!

Tino

--
Tino Korth Registered Linux User #286417
www.tinokorth.de - ICQ 10771191 http://counter.li.org

Ralf Bender

unread,
Sep 24, 2002, 5:28:10 AM9/24/02
to
Hello Tino,

maybe with is you're looking for:
select to_char(0.5,'0D0') from dual

bye
Ralf

>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<

Am 24.09.2002, 11:08:44, schrieb Tino Korth <news...@tk79.de> zum Thema
number format (.5 instead of 0.5):

Tino Korth

unread,
Sep 24, 2002, 5:44:25 AM9/24/02
to
Hello,

> maybe with is you're looking for:
> select to_char(0.5,'0D0') from dual

that's it! :o)

Is is possible to set that format session-wide (ALTER SESSION SET ...)?

Jim Kennedy

unread,
Sep 24, 2002, 10:20:52 AM9/24/02
to
AFAIK, no. Oracle is just giving you something that is a number. You are
interested in how the number looks on the screen. Two different things. In
whatever, tool you are using you could write a format function.
Jim
"Tino Korth" <news...@tk79.de> wrote in message
news:ampc5g$a68$1...@nntp-m01.news.aol.com...

Ranga Chakravarthi

unread,
Sep 24, 2002, 7:56:38 PM9/24/02
to
If you are doing this in SQL*Plus, use the format option for the column to
display:

SQL> create table number_test (a number);

Table created.

SQL> insert into number_test values (.5);

1 row created.

SQL> col a format 999,990.99
SQL> select * from number_test;

A
-----------
0.50

SQL> col a format 999,990.9
SQL> select * from number_test;

A
----------
0.5

"Tino Korth" <news...@tk79.de> wrote in message

news:ampa2j$3tp$1...@nntp-m01.news.aol.com...

0 new messages