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 s...@ibphoenix.com [firebird-support] <firebird-support@yahoogroups.com> wrote: 22.06.2019 21:47, 'Mr. John' mr_joh...@yahoo.com [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