Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FORALL and Dynamic Table name

848604Mar 18 2011 — edited Mar 21 2011
Hi,

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
This post has been answered by pollywog on Mar 18 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2011
Added on Mar 18 2011
5 comments
1,993 views