Im trying to get some returning data from an postgresql update. The "update" works well in the DB script, but in java I'm having some issues: the code stucks while executing the query.
I'm trying with "PreparedStatament ps", "ResultSet rs=ps.executeQuery" and "if(rs.next)" to get the data from the "returning" in the query, but it appears that the code didnt get in there, because it stuck exactly in the "ps.executeQuery".
Here's more or less what I'm trying to do:
String cVal="";
ps=myConn.prepareStatement("UPDATE someTable SET aValue=? WHERE bValue=?
returning Cvalue");
ps.setInt(1,"aNewValue");
ps.setInt(2,"aID");
rs=ps.executeQuery();
if (rs.next()){
cVal=rs.GetString("Cvalue");
return true;
}else{
return false;
}
I'm trying to set the values of "RETURNING" to some variables. There are 4 results that I want to set.