Iterate for each row in SQLITE JDBC Table to update only specific cell values in that row

StackOverflow https://stackoverflow.com/questions/19981800

  •  30-07-2022
  •  | 
  •  

I have to iterate over each row in SQLITE JDBC on-memory table in order to update the cell value of one of the columns using the cell value of another column in the same row.

E.g. For each row in the table, take cell value of column 3, make some minor changes and put this value in cell of column 6 in the same row.

What would be the best approach for this, lie most optimized way of doing this.

So the main question is how to iterate over each row in table. I am not sure if it's a valid question. But would like to know suggestions or perhaps some sample snippet.

没有正确的解决方案

其他提示

You can use any SQL expression in the UPDATE statement:

stmt.executeUpdate("UPDATE MyTable SET Col6 = Col3 + 123");
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top