Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

[GENERAL] Simple math statement - problem

From: Postgres User <postgres.developer(at)gmail.com>
Date: Fri Nov 30 2007 - 00:22:01 EST


I have a large function that's doing a number of calcs. The final return value is wrong for a simple reason: any division statement where the numerator is less than the denominator is returning a zero.

Each of these statements return a 0, even when properly cast:

select 1/100
select Cast(1 / 100 As decimal)
select Cast(1 / 100 As numeric(6,2))

How can I write statements that returns a decimal?

The problem doesn't appear to be that Postgres won't return decimal values, as these statements return the correct value:

select .01
select Cast(.01 As decimal)

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings Received on Fri Nov 30 05:05:14 2007

This archive was generated by hypermail 2.1.8 : Mon Jun 16 2008 - 20:57:35 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library