[Info-Ingres] Rounding in Ingres

flip+ at andrew.SeeEmmYou.EeeDeeYou flip+ at andrew.SeeEmmYou.EeeDeeYou
Wed Apr 11 10:22:08 CDT 2007


"Anderson, Troy E." <AndersonTE at bvsg.com> writes:
> select decimal(1.3451,6,2)  ==> results in the value 1.34, where I'd
> like a value of 1.35.   

>I also have to deal with negative numbers, where this math trick
>needs to work differently, so I've had to write a case statement to
>use a decimal conversion adding .005 for positive numbers and a
>subtracting .005 for negative numbers.

how about 
select decimal(data1 + (data1/abs(data1) * .005),6,2)

?

-- 
flip
Just on the border of your waking mind, There lies - Another time,
 Where darkness & light - are one. And as you tread the halls of sanity,
  You feel so glad to be, Unable to go beyond.  ELO - Twilight Prologue



More information about the Info-Ingres mailing list