resultset condition
Hi
I am trying to check for records being available in my table based upon which i want to do an update or insert.
To check for this i tried getting row count for that condition
i got the row count in a variable. then if rowcount > 0
then i proceed with update or else i try the insert.But the problem is that i get a null pointer exception immedeatly after the sql where i get the row count.
How do i tackle this
sql = "select count(*) nRows from employee where dept = '10'"
rs = stmt.executeQuery(sql);
while(rs.next()) {
nRows = rs.getInt(1);
if (nRows > 0) {
perform update}
else( perform insert)
}
Thanks
Arn

