Hello, I am trying to load some data into Oracle using JDBC. One of the fields is of type integer. There are instances that the data may be null. When I manually execute "INSERT INTO .." statement I was able to load a null value to integer field, but not through 'setInt' method. Can anyone shed some light on this? Thanks Suresh
Dave Vick
Ranch Hand
Joined: May 10, 2001
Posts: 3244
posted
0
Suresh I assume your talking about in a PreparedStatement? You'll need to use the setNull method. I guess it is the same philosophy as testing a ResultSet for null, since it is a special vlaue it is handled separatley. hope that helps
Dave
Suresh Kanagalingam
Ranch Hand
Joined: Aug 17, 2001
Posts: 82
posted
0
Hi Dave, When I try to run the line "ps.setNull (5, java.lang.Types.INTEGER)" I am getting "java.lang.NumberFormatException" message. I am using JDK1.1.8. Any thoughs? Thanks Suresh
Suresh Kanagalingam
Ranch Hand
Joined: Aug 17, 2001
Posts: 82
posted
0
Dave, I found the error. When I checked the Oracle site, according to Oracle I need to use 'OracleTypes.NUMBER' for JDK 1.1.x. And it works. Thanks Suresh