views:

112

answers:

3

What would be the datatype in java equivalent to the PL/SQL datatype BINARY_INTEGER?

+1  A: 

BINARY_INTEGER is a subtype of INTEGER and ranges from -2^31 to 2^31, same size as the int type in java, so you could use int.

(Another equivalent type in PL/SQL to BINARY_INTEGER is PLS_INTEGER and this one is faster in most operations).

najmeddine
+3  A: 

According to the Oracle documentation, we can map it to either oracle.sql.NUMBER or a straightforward int primitive.

APC
A: 

If you're lazy in reading the documentation, then you could also play a bit with ResultSet#getObject() to see what default type the JDBC driver returns and then use it.

System.out.println(resultSet.getObject("columnname").getClass());
BalusC