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 + execute immediate + remote database?

User_5OAFPJan 17 2013 — edited Jan 18 2013
There are two database: DB1 local and DB2 remote, both Oracle 11g R2.
On local database DB1 I collect some data from remote one with the help of the following code:
..
v_acct_id := 999;
..
v_stmt := 'select x, y from some_table@' || db_link_to_DB2 || ' where acct_id = :val';
..
execute immediate v_stmt bulk collect into v_collection using v_acct_id;
..
The code above fills the v_collection with values of x, y properly.
Now I would like to delete remotely from some_other_table based on the values {x} just collected and with use of forall operator (ie. using bulk operation). If I was working on DB2 database what I would like to do could be coded like this:
delete some_other_table
where x in ( select x from some_table where acct_id = 999 );
But is it possible to archive the same result with the help of FORALL operator, EXECUTE IMMEDIATE and v_collection over db link so that this could be invoked on local DB1 database? If so, how this can be coded?

thank you
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2013
Added on Jan 17 2013
20 comments
2,829 views