How can I use the PL / SQL BINARY_INTEGER data type as Java types?

What will be the data type in java equivalent to the PL / SQL data type BINARY_INTEGER?

+3
source share
3 answers

According to Oracle documentation , we can match it either with oracle.sql.NUMBERor with a simple primitive int.

+3
source

BINARY_INTEGERis a subtype of INTEGER and ranges from -2^31to 2^31, the same size as type intin java, so you can use int.

(Another equivalent type is in PL/SQL- BINARY_INTEGER- PLS_INTEGER, and in most operations this process is faster).

+1

If you're lazy about reading the documentation, you can also play ResultSet#getObject()around a bit to find out what type the default JDBC driver returns, and then use it.

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

Source: https://habr.com/ru/post/1723040/


All Articles