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!

ORA-04054 : using variable substitution for the database link name

user6546Mar 2 2006 — edited Mar 2 2006
Hi,

I need to use variable substitution for the database link name.
Here is my command :

declare
GET VARCHAR2(50);
begin
select OIA_GET_DESIGNATION into GET from INFODRI.OMA_IN_ARTICLES;
for rec in (select * from tensions@rec.OIA_GET_DESIGNATION)
LOOP
dbms_output.put_line('TEN_CODE vaut : '||rec.ten_code);
END LOOP;
exception
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERREUR ORACLE DETECTEE : '||rec.OIR_CUR);
DBMS_OUTPUT.PUT_LINE('Message Erreur : '||SUBSTR(SQLERRM,1,245));
:crd := -1;
end;
/

When I run this programm, I receive the error :
ORA-04054: database link REC.OIA_GET_DESIGNATION does not exist

When I replace :
for rec in (select * from tensions@rec.OIA_GET_DESIGNATION)
by :
for rec in (execute immediate 'select * from tensions@'||rec.OIA_GET_DESIGNATION)

I receive the error :
PLS-00103 : Encountered the symbol "IMMEDIATE" while parsing.

What can I do to resolv my problem ?


Regards,
Rachel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2006
Added on Mar 2 2006
2 comments
989 views