Hi,
I am using ORACLE Database 11g .
I have a procedure in which i am already passing some parameters. The procedure contains few statements in which it has to refer to specific user for getting the data. So we use DB Link. As which user to connect is not sure so the DB LINK is also not constant. That is why i want to pass the DB link as a parameter to procedure. But if i don't give the db link name in procedure the procedure will not compile.
A sample of my code is as follows :-
create or replace procedure P_GET_TABLES(V_DBLINK in varchar2)
as
FOR I in (select s.TABLE_NAME
from user_tables@V_DBLINK s, dba_tables d --- Obviously it gives me error that table does not exists.Due to variable V_DBLINK
where d.table_name = s.TABLE_NAME
and s.TABLE_NAME != 'ERROR_LOG'
and d.owner = V_SOURCE_SCHEMA_NAME
union (select s.TABLE_NAME
from user_tables@V_DBLINK s
minus
select TABLE_NAME
from dba_tables d
where owner = V_SOURCE_SCHEMA_NAME)) Loop
-- other code for the process.....
END LOOP;
END;
/
Is their any method that i can pass a compiled procedure DB LINK as parameter or at run-time. ??
Thanks in advance.