Re: [firebird-support] Arithmetic overflow or division by zero has occurred.

2012-03-29 Thread Ismael L. Donis Garcia
Perfect

1 million of thanks
=
|| ISMAEL ||
=
  - Original Message - 
  From: Huan Ruan 
  To: firebird-support@yahoogroups.com 
  Sent: Thursday, March 29, 2012 5:13 PM
  Subject: Re: [firebird-support] Arithmetic overflow or division by zero has 
occurred.



  On 30 March 2012 03:21, Ismael L. Donis Garcia wrote:

  > **
  >
  >
  > That operation does not give the precision that I need ( 6 digits after
  > decimal point )
  >
  > SELECT 54311.999455*cast((1/1.01) as integer) as mount FROM
  > MON$ATTACHMENTS r = 54311.999455
  >
  > 54311.999455 / 1.01 = 54311,945143
  >

  Cast one of the numbers in your calculation as "double precision", e.g.

  SELECT cast(cast(54311.999455 as double precision)/1.01 as
  numeric(16,6)) as mount FROM rdb$database

  Cheers
  Huan

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



  

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



Re: [firebird-support] Arithmetic overflow or division by zero has occurred.

2012-03-29 Thread Huan Ruan
On 30 March 2012 03:21, Ismael L. Donis Garcia wrote:

> **
>
>
> That operation does not give the precision that I need ( 6 digits after
> decimal point )
>
> SELECT 54311.999455*cast((1/1.01) as integer) as mount FROM
> MON$ATTACHMENTS r = 54311.999455
>
> 54311.999455 / 1.01 = 54311,945143
>

Cast one of the numbers in your calculation as "double precision", e.g.

SELECT cast(cast(54311.999455 as double precision)/1.01 as
numeric(16,6)) as mount FROM rdb$database

Cheers
Huan


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



Re: [firebird-support] Arithmetic overflow or division by zero has occurred.

2012-03-29 Thread Ismael L. Donis Garcia
That operation does not give the precision that I need ( 6 digits after decimal 
point )

SELECT 54311.999455*cast((1/1.01) as integer) as mount FROM MON$ATTACHMENTS 
r  = 54311.999455

54311.999455 / 1.01 = 54311,945143

Thank you for everything
=
|| ISMAEL ||
=
  - Original Message - 
  From: Svein Erling Tysvær 
  To: 'firebird-support@yahoogroups.com' 
  Sent: Thursday, March 29, 2012 3:24 AM
  Subject: RE: [firebird-support] Arithmetic overflow or division by zero has 
occurred.



  >SELECT cast((5411.000455/0.20) as numeric(16,6)) as mount FROM 
MON$ATTACHMENTS r

  This particular query can be rewritten as

  SELECT 5411.000455*cast(1/0.20 as integer) as mount FROM MON$ATTACHMENTS r

  Though it will not work equally well with other numbers, at least not if 
cast(1/0.xx as numeric(16, 4)) doesn't yield sufficient precision when 
doing 5411.000455*ResultFromAbove.

  HTH,
  Set


  

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



RE: [firebird-support] Arithmetic overflow or division by zero has occurred.

2012-03-29 Thread Svein Erling Tysvær
>SELECT cast((5411.000455/0.20) as numeric(16,6)) as mount FROM 
>MON$ATTACHMENTS r

This particular query can be rewritten as

SELECT 5411.000455*cast(1/0.20 as integer) as mount FROM MON$ATTACHMENTS r

Though it will not work equally well with other numbers, at least not if 
cast(1/0.xx as numeric(16, 4)) doesn't yield sufficient precision when 
doing 5411.000455*ResultFromAbove.

HTH,
Set


[firebird-support] Arithmetic overflow or division by zero has occurred.

2012-03-28 Thread Ismael L. Donis Garcia
FB 2.5.1 superclasic

SELECT cast((5411.000455/0.20) as numeric(16,6)) as mount
FROM MON$ATTACHMENTS r

*** IBPP::SQLException ***
Context: Statement::Fetch
Message: isc_dsql_fetch failed.

SQL Message : -802
Arithmetic overflow or division by zero has occurred.

Engine Code: 335544321
Engine Message :
arithmetic exception, numeric overflow, or string truncation
numeric value is out of rang



As I can solve this problem without decreasing the number of decimal?

Best Regards
=
|| ISMAEL ||
=

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