Subject | Re: [firebird-support] Problem with division |
---|---|
Author | Helen Borrie |
Post date | 2004-02-05T06:00:49Z |
At 09:36 PM 4/02/2004 -0800, you wrote:
"correct" by SQL rules. If you want a decimal portion in the result, you
have to include it in one or both of the operands, e.g.
Pct = Cast(( (1.000 * 29920) / (1.000 * 106532)) as Numeric(8,6) );
/hb
>Greetings,Integer/integer division returns an integer in ODS 10, so the result is
>I'm using FB 1.03 and have the following SP:
>
>create procedure sp_test_pct
>returns (Pct Numeric(8,6))
>as
>begin
> Pct = Cast((29920 / 106532) as Numeric(8,6) );
> suspend;
>end
>
>Right now, Pct is returned as all zeros and it should be something like:
>0.280854
>
>I've tried w/out the casting as well with the same zero results.
>
>Any ideas would be GREATLY appreciated.
"correct" by SQL rules. If you want a decimal portion in the result, you
have to include it in one or both of the operands, e.g.
Pct = Cast(( (1.000 * 29920) / (1.000 * 106532)) as Numeric(8,6) );
/hb