Subject Re: [firebird-support] query Integer overflow
Author Mr. John
the error is gone if I cast one of the values as integer (at this moment there is no decimal needed for that field):


   CAST (b.P_TV_E AS INTEGER)  
instead of 
 b.P_TV_E

 

 SELECT   b.cant*  IIF(b.PR_EAT_T<>0, b.PR_EAT_T-b.PR_EAT_T   *  CAST (b.P_TV_E AS INTEGER)   /(100+   CAST (b.P_TV_E AS INTEGER)    ), b.PR_I)
                 FROM GS_FIED a INNER JOIN GS_FIEP b on a.id=b.id_doc





On Sunday, June 23, 2019, 12:42:42 AM GMT+3, Dimitry Sibiryakov sd@... [firebird-support] <firebird-support@yahoogroups.com> wrote:


22.06.2019 21:47, 'Mr. John' mr_johnmr@... [firebird-support] wrote:

> I'm facing with this error on FB 2.5.8(latest stable version)/ W10 x64


  My advice is "never perform calculations (especially multiplication and division) in SQL".
  Your expression has result of type NUMERIC(18,14) and result of calculation is bigger
than 9999.


--
  WBR, SD.


------------------------------------

------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
------------------------------------

Yahoo Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-digest@yahoogroups.com
    firebird-support-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscribe@yahoogroups.com

<*> Your use of Yahoo Groups is subject to:
    https://info.yahoo.com/legal/us/yahoo/utos/terms/