title: How to get a value from an executeUpdate OR update in java?
body: <p>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.</p>
  
  <p>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". </p>
  
  <p>Here's more or less what I'm trying to do:</p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>I'm trying to set the values of "RETURNING" to some variables. There are 4 results that I want to set.</p>