intVar = ResultSet.getInt(i) => NPE; how to handle?
807598Jul 25 2006 — edited Jul 30 2006Hello, no code example since this shouldn't be too difficult to explain. I'm calling a storedproc and attempting to store the value from one of the columns in an int primitive. However, occasionally this value is NULL in the db, and attempting to store a null in an int throws an NPE. Is there a function (like Javascript's isNaN) that I can use to test the ResultSet value, and if null, assign -1 or something to the int var instead? I've searched these forums, Google, and the docs, but get back thousands of results for strings like 'null int ResultSet', and don't see the answer in the top few results. Thanks!