Subject | Re: [firebird-support] Re: Query giving "Unsuccessful execution caused by system error" |
---|---|
Author | Alexandre Benson Smith |
Post date | 2005-03-29T14:47:28Z |
Hi Andrew,
andrew_s_vaz wrote:
try this and look if it helps
sum (cast((((( cast(i.ItrHon as double precision) * i.ItrMultHon * i.ItrVlrIndxFat) *
(i.ItrPorcCob/100)) * (1-(i.ItrDescontoTab/100)) )* i.ItrMultTab) as numeric(14,4)) as
VlrFat,
I hope I put the parenthesis on the right place, but what I did was
convert one of the values to double precision, so FB will make the whole
calc using double precision and then convert back to numeric(14,4), I
think this way you will not get the overflow.
try and report back if it helps.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005
andrew_s_vaz wrote:
>Hi Alexandre,Helen answered you about the BCD type and how your calc are overflowing.
>
>
>
>>What the type of the involved fields ?
>>
>>If they are numeric(x,y) (or decimal) you are getting problem
>>
>>
>because the lot of multiplications and divisions, that is leading to
>an overflow on the decimals...
>
>
>>Try casting those columns to double precision.
>>
>>
>>
>
>I think it's the sum equation also, but I'm sure that I'm not doing
>any illegal math (divide 0 and stuff like that). It is working in the
>other app.
>
>The types of data are:
>
>ITRPORCCOB DECIMAL(14,4),
>ITRHON DECIMAL(14,4),
>ITRMULTHON DECIMAL(14,4),
>ITRDESCONTOTAB DECIMAL(14,4),
>ITRVLRINDXFAT DECIMAL(14,4),
>ITRMULTTAB SMALLINT
>
>as I need to work with BCD types. ITRMULTTAB is only a multiplier, so
>it's a smallint.
>
>Are my definitions of BCD right? DECIMAL(14,4)?
>
>
>Thanks
>Andrew
>
>
try this and look if it helps
sum (cast((((( cast(i.ItrHon as double precision) * i.ItrMultHon * i.ItrVlrIndxFat) *
(i.ItrPorcCob/100)) * (1-(i.ItrDescontoTab/100)) )* i.ItrMultTab) as numeric(14,4)) as
VlrFat,
I hope I put the parenthesis on the right place, but what I did was
convert one of the values to double precision, so FB will make the whole
calc using double precision and then convert back to numeric(14,4), I
think this way you will not get the overflow.
try and report back if it helps.
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 23/03/2005