Oracle pl/sql: executing dynamic delete within a transaction
Clash Royale CLAN TAG #URR8PPP Oracle pl/sql: executing dynamic delete within a transaction I need to delete one or more row from list of tables stored in a table, and commit only if all deletion succeed. So I wrote something like this (as part of a bigger procedure): BEGIN SAVEPOINT sp; FOR cur_table IN (SELECT * FROM TABLE_OF_TABLES) LOOP EXECUTE IMMEDIATE 'DELETE FROM ' || cur_table.TABNAME || ' WHERE ID = :id_bind' USING id; END LOOP; EXCEPTION WHEN OTHERS THEN ROLLBACK TO SAVEPOINT sp; END; I know this couldn't work, because of the "execute immediate". So, what is the correct way to do that? what is the issue? are you having an error, a wrong result, ... ? – Aleksej 1 hour ago I haven't tried yet. I guess "execute immediate...