Hello
I have problem with large numbers, for example i try execute sql
select 24586655153356484 "id" from dual
and i want to see in result object
[ { id: 24586655153356484 } ]
but i see in result
[ { id: 24586655153356500 } ]
if i change sql query to
select to_char(24586655153356484) "id" from dual
i get correct result
[ { id: '24586655153356484' } ]l
How get correct number value?
i use
oracledb.outFormat = oracledb.OBJECT
2019-07-12 11:28:12.434 DEBUG App.OraLocal - Node Version v8.11.3
2019-07-12 11:28:12.435 DEBUG App.OraLocal - Architecture x64
2019-07-12 11:28:12.436 DEBUG App.OraLocal - Client Version 12.1.0.2.0
2019-07-12 11:28:12.470 DEBUG App.OraLocal - Database Version 10.2.0.1.0
sorry for my english.
This is expected behaviour. Node.js uses double precision floating point numbers which permits 15-16 decimal digits of precision. The number you are requesting has 17 decimal digits of precision. In order to process this number you will need to use fetchAsString and then convert the resulting string to a type that supports that precision -- like BigInt. Since you're using Node.js 8.11 that won't work for you. You'll have to upgrade to at least 10.4 to use that type. Or you can use a type like BigInteger that supports older versions.
Thank