Unix Technical Forum

do not cut decimal places

This is a discussion on do not cut decimal places within the Oracle Database forums, part of the Database Server Software category; --> Hi, following problem (oracle8): I want to insert a value with precision (#.##) in a number(10,2) column. It works ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 06:39 PM
Marek Lange
 
Posts: n/a
Default do not cut decimal places

Hi,

following problem (oracle8): I want to insert a value with precision
(#.##) in a number(10,2) column. It works but the values which end with
..0 or .00 are always truncated:

100.00 --> 100
1000.0 --> 1000

Is there a way to prevent this and to show the decimal places although
they are 0?

Thanks,

-marek

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-22-2008, 06:39 PM
Eric Parker
 
Posts: n/a
Default Re: do not cut decimal places


"Marek Lange" <marek.lange@web.de> wrote in message
news:3F02A2D0.9090902@web.de...
> Hi,
>
> following problem (oracle8): I want to insert a value with precision
> (#.##) in a number(10,2) column. It works but the values which end with
> .0 or .00 are always truncated:
>
> 100.00 --> 100
> 1000.0 --> 1000
>
> Is there a way to prevent this and to show the decimal places although
> they are 0?
>
> Thanks,
>
> -marek
>


Marek

This is a problem with the way your application is formatting the data.
You haven't supplied any information about what is doing the formatting.

SQL> SELECT to_char(a, '9999.99') from t;

TO_CHAR(
--------
9.99
10.00
10.01

SQL> SELECT a from t;

A
----------
9.99
10
10.01

SQL>

HTH

eric


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-22-2008, 06:39 PM
andrewst
 
Posts: n/a
Default Re: do not cut decimal places


Originally posted by Marek Lange
> Hi,
>
> following problem (oracle8): I want to insert a value with precision
> (#.##) in a number(10,2) column. It works but the values which
> end with
> .0 or .00 are always truncated:
>
> 100.00 --> 100
> 1000.0 --> 1000
>
> Is there a way to prevent this and to show the decimal places although
> they are 0?
>
> Thanks,
>
> -marek

You do not have a problem, you have a misunderstanding. You are
confusing the storage of numbers with the display format. If you want
to see 2 decimal places, format the output. e.g. in SQL:

select TO_CHAR(value,'99990.00') from tab;

--
Posted via http://dbforums.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:37 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com