Skip to Main Content

Oracle Database Discussions

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!

execute immediate and connect statement

user256760Sep 9 2009 — edited Sep 9 2009
Hi,

How do you connect to another database via a db link using dynamic sql eg using the execute immediate statement?

i need to do something like;

CREATE OR REPLACE PROCEDURE exec_proc1_remotely AS
BEGIN
EXECUTE IMMEDIATE 'CONNECT user1/mypassword@mydb.world'; --????
app.proc1;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20201, 'exec_proc1_remotely' || SQLERRM);
END;

i am avoiding using scripts by trying to use the above, but i am getting the error "Invalid sql statement" when i run the procedure.
i am using Oracle 11g.

please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 7 2009
Added on Sep 9 2009
3 comments
2,585 views