3

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

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

Comments

1

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).

Comments

0

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()); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.