OHDSI / OHDSI/DatabaseConnector

Numeric Overflow with Oracle and Precision less than 19

Open
#222 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
57
Forks
93
Avg merge
10d 12h
Merged PRs (30d)
1

Description

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’

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with DatabaseConnector::querySql and reproduce the CAST(2147483648 AS NUMBER(18,0)) query against Oracle through JDBC. Trace where the numeric result is converted and verify that the query returns 2147483648 without a numeric overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, r, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.