I need to batch insert some rows in a temp table and later delete them. What i need a unique id which can specifically identify and delete rows which are inserted in a single transaction. How do I achieve this?
Thanks in advance
I want to place a few rows in a temp table using batch insert, use it to do some joins etc with other tables in db, and delete those rows after it is done. So once the data is used, I should be able to delete them. There might be many users using this temporary table simultaneously hence I need some unique id to specify rows inserted in a single insert so that they can be deleted with a simple delete statement without deleting the rows other users enter at that time
delete from table where = ‘xxx’
The usual approach is to use a sequence to generate your Batch ID beforehand and then provide that Batch ID to your INSERT statement: