I want to get the primary key column value for the rows which were affected by query in Java. I am using MySql DB. Suppose query is like,
update user set pincode = 390023 where area like '%ABC Road%'
Then in java, I want the ids of each row (Primary key of each row) updated. Something that can be possible with Statement object in Java may be.
Select the rows just before you update them.
Use
select id from user where area like '%ABC Road%'.Remember to enclose those two operations in transaction to avoid row changes between those two.