Click to See Complete Forum and Search --> : Dd link parameter


fraze
08-18-2004, 07:58 AM
I'm trying to pass in the first part of a db link with a parameter in a procedure but cant seem to get the syntax right - can anyone please help?


PROCEDURE INVALID_OBJECTS1 (p_dbsid varchar)
IS
cursor c_total_inv_obj is
select owner,object_name, object_type
from dba_objects@p_dbsid||'.world'
where status = 'INVALID'
and object_type in ('PACKAGE BODY','PACKAGE','FUNCTION',
'PROCEDURE','TRIGGER','VIEW','QUEUE');

marist89
08-18-2004, 09:21 AM
you can't do it throught straight pl/sql like that. You have to use dynamic sql.

raghud
08-18-2004, 12:27 PM
As Jeff mentioned use execute immediate

v_sql = 'select .... oracle' + '.world'

execute immediate(v_sql)

gandolf989
08-18-2004, 12:29 PM
You should take a look at ref cursors.