Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Numeric precision conversion : truncation instead of rounding

Re: Numeric precision conversion : truncation instead of rounding

From: Jim Kennedy <kennedy-downwithspammersfamily_at_attbi.net>
Date: Tue, 25 Oct 2005 19:27:04 -0700
Message-ID: <yLGdndl7cdKDdMPeRVn-1w@comcast.com>

"morsi" <morsi_tn_at_yahoo.fr> wrote in message news:1130273476.238378.10300_at_g49g2000cwa.googlegroups.com...
> I'm working in a project of converting an application from Syabse to
> Oracle (1000 man-day).
> In Sybase, the result of convert(numeric(4,2),1.2378) is 1.23
> In Oracle, the result of cast(1.2378 as number(4,2)) is 1.24
> I look the same thing in implicit conversion : insert number(6,4) value
> in a table column of the type numeric(4,2)
> How to modify the oracle behaviour (any server option ? )to do
> truncation instead of rounding ? Of course I can use truncate function
> but it will complicate all the obvious conversions.
> Thanks.
>

No you can't change the conversion behavior. Doesn't rounding make more sense? And even if it didn't then wouldn't explicit conversion be a much better than relying on a particular behavior of a conversion? Use trunc if you want to truncate.
Jim Received on Tue Oct 25 2005 - 21:27:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US