Subject RE: [ib-support] Re: Stored Proc : cast to float?
Author Amrita Chaudhury
I tried both this method and the one suggested by Tony earlier :
cast(varname to float).
I am getting a strange error when I change my stored proc to do that.

Without the cast or the (xx*1.00) approach, the stored proc executes fine.
But whenever I try any of these approaches, I het a
"arithmetic overflow string concatenation " error .

Does anybody know why a cast to float should trigger such error?

Another strange observation is that this error is generated only if the
stored proc returns
rows more than around 50 !!!


Please help -

amrita .


-----Original Message-----
From: csswa [mailto:csswa@...]
Sent: Saturday, July 06, 2002 4:52 AM
To: ib-support@yahoogroups.com
Subject: [ib-support] Re: Stored Proc : cast to float?



There is another way that bypasses explicit casting. I don't
recommend it -- I've yet to hear of others doing it this way -- but
mention it here as a curiosity. When dividing integers you can
control the scale used by each value by inserting a dummy value:

(FOO_INTEGER1 * 1.00) / (FOO_INTEGER2 * 1.00)

resulting in integer1 getting cast internally to two decimals places
and ditto for integer2. The result gives the expected four-digit
scale. And with this:

(FOO_INTEGER1 * 1.00) / (FOO_INTEGER2 * 1.0)

you get a result with three decimal places.

My 'five-dollar calculator' experience with FB taught me:

* you only need to be cautious with integers (casting) when dividing,
and even then only with dialect 3;
* beware divide by zero!

For your IB edification, here is the DDL illustrating all of the
above.

CREATE TABLE TEST (
F_ONE INTEGER,
F_TWO INTEGER,
F_THREE COMPUTED BY ((F_ONE * 1.000) / (F_TWO * 1.000)),
F_FOUR COMPUTED BY ((F_ONE * 1.00) / (F_TWO * 1.00)),
F_FIVE COMPUTED BY ((F_ONE * 1.00) / (F_TWO * 1.0)));

Hopefully I got all the facts right above, but if not I'm sure the
gurus here will set me straight.

Regards,
Andrew Ferguson
-- Who do you believe - me, or your mother?


--- In ib-support@y..., Amrita Chaudhury <achaudhu@s...> wrote:
> Thanks, that works !!
>
> amrita .
>
> -----Original Message-----
> From: Tony Caduto [mailto:tcaduto@a...]
> Sent: Friday, July 05, 2002 9:06 AM
> To: ib-support@y...
> Subject: Re: [ib-support] Stored Proc : cast to float?
>
>
> how about cast(yourfieldorvar as float)
>
>
> >
> > How can I "cast" the division of two integers to a
> > float operation ?
> .
>
>
>
> Yahoo! Groups Sponsor
> {short description of image}
>
< http://us.a1.yimg.com/us.yimg.com/a/de/debtscape/dt_59_468x60north.gi
<http://us.a1.yimg.com/us.yimg.com/a/de/debtscape/dt_59_468x60north.gi>
f>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@e...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
> < http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> >
.
>
>
>
>
> [Non-text portions of this message have been removed]


To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .




[Non-text portions of this message have been removed]