Page 1 of 1

Numeric value out of range" exception in fetch_nd() of VIP 7.4 application

Posted: 20 Mar 2015 19:05
by loveProlog
We have the same application written in 5.2 & 7.4 on the same SQL DB.
There is a column defined as numeric (12,0). When retrieving the data (has value greater than max of integer, for example, 5000000370) from two applications on 5.2 & 7.4, 5.3 application works w/o any error. But 7.3 application throws "Numeric value out of range" exception.

I understand the reason why it throws the exception since the value (5000000370) is greater than max of integer. The workaround is to define as varchar.

What I do not understand is that why it was working fine in 5.2 application.
I am using fetch_nd() in 7.4 application and sql_FetchNext(Stmt) in 5.2 application

I will appreciate your help in advance

Posted: 20 Mar 2015 19:53
by Thomas Linder Puls
Well, it can obviously not work in vip5.2: It may not raise an exception, but the result must be wrong, because also in Vip5.2 an integer cannot represent the mentioned number.

I am not really sure what you want help with?

Posted: 23 Mar 2015 14:30
by loveProlog
My question was why 5.2 apps worked but 7.4 apps raised the exception.
I tested the same scenario in both version apps.
5.2 apps worked as expected.
I was wondering maybe 5.2 & 7.4 support different version of odbc.

Posted: 26 Mar 2015 9:39
by Thomas Linder Puls
In my mind it is the Vip 7.4 program that work and the Vip 5.2 doesn't work, it does not raise an exception for an overflow/out of range problem that does indeed exist, instead it simply returns a wrong value.

My guess is that you simply receive those bits of the number that fits into a 32bit integer. Your number is 0x12A05F372 (i.e. in hex) fitting it to 32bit gives 0x2A05F372 which is 705033074 in decimal.

If you use the same ODBC connection then you also use the same driver, there may be a difference in various parameter settings used by the two programs, but here it seems that the Vip5.2 program ignores an overflow/our of range error somewhere.