in reply to
getting the ids of records affected by an input statement
failing any provisions any particular db provides returning affected rows, or even db logs...you could add a column to the table that will hold your marker for your updates. Each time you do the update, programmatically pick a value that will be used in the update. after some updates, you will be able to query the db for the value(s) in that column. this guarantees atomicity with your update statement, so doesn't suffer latency issues if you do a select and then the equivalent update. I'd only do this (extend the table) if your requirement is part of the "business rules", and hence part of the specification for the database schema.
the hardest line to type correctly is: stty erase ^H