OHDSI / DatabaseConnector

An R package for connecting to databases using JDBC.
http://ohdsi.github.io/DatabaseConnector/
54 stars 80 forks source link

Numeric Overflow with Oracle and Precision less than 19 #222

Open illoRocks opened 1 year ago

illoRocks commented 1 year ago

Hello,

An error occurs when I try to retrieve large numbers from an Oracle database. The error occurs when a numeric value is greater than 2147483647 and the data type has a precision less than 19.

The following statement works in IDEA:

select CAST(2147483648 AS NUMBER(18,0)) as A from dual;

image

When I try to do this with the DatabaseConnector I get the following error:

> DatabaseConnector::querySql(
+   connection,
+   "select CAST(2147483648 AS NUMBER(18,0)) as N from dual"
+ )
Error in `.createErrorReport()`:
! Error executing SQL:
java.sql.SQLException: Numeric Overflow
An error report has been created at  /.../errorReportSql.txt
Run `rlang::last_error()` to see where the error occurred.
>
> packageVersion("DatabaseConnector")
[1] ‘6.0.0’
ChungsooKim commented 1 year ago

Hi, The bottom part of this post may help you. https://github.com/OHDSI/DatabaseConnector/issues/149#issuecomment-860609235