FORALL and Dynamic Table name
848604Mar 18 2011 — edited Mar 21 2011Hi,
How to pass table name dynamically to a FORALL ?
................................................................................................
FORALL i IN 1..cursor_delete.count
DELETE from EMP WHERE ROWID = cursor_delete (i);
................................................................................................
The above code works fine but the table name is hard coded. Now to make it dynamic, my understanding is that we need to use dynamic sql which means execute immediate must be used as well ..
But the below code using execute immediate doesn't work after a FORALL :
................................................................................................
FORALL i IN 1..cursor_delete.count
execute immediate 'DELETE from '|| table_name||' WHERE ROWID = cursor_delete (i)';
................................................................................................
Any ideas please?
Thanks