BigInteger support for NUMERIC columns in JDBC

Douglas Surber douglas.surber at oracle.com
Thu Nov 7 18:10:20 UTC 2019


Seems reasonable. I assumed Oracle Database JDBC already supported this, but when I looked at the code it does not. 

Douglas

> On Nov 7, 2019, at 8:38 AM, pm at netcetera.ch wrote:
> 
> Hello
> 
> Since people are reposting their suggested improvements for JDBC I'll respost one of mine: BigInteger support for NUMERIC columns.
> 
> Officially BigInteger is only supported for BIGINT columns. If I have a NUMBER(19) column I need to do
> 
> .getBigDecimal(x).toBigIntegerExact()
> 
> it would be more convenient if I could do
> 
> .getObject(x, BigInteger.class)
> 
> 
> For that BigInteger would have to be supported for any DECIMAL or NUMERIC column with a 0 scale in addition to TINYINT, SMALLINT, INTEGER, BIGINT columns.
> 
> These column types already support Long. Long in addition supports FLOAT, DOUBLE, BIT, BOOLEAN, CHAR, VARCHAR, LONGVARCHAR. These can be added for consistency. Unfortunately I could find no documentation for what should happen for Long if there is a non-zero scale.
> 
> To my understanding this needs an update to TABLE B-5.
> 
> Such a change would be source compatible and could be implemented easily in drivers supporting multiple versions.
> 
> Philippe



More information about the jdbc-spec-discuss mailing list