SQL Language (MOSC)

MOSC Banner

create a function that receives a dblink as parameter

edited Jan 29, 2013 8:19AM in SQL Language (MOSC) 1 commentAnswered
I need a function that returns the name of a datafile that is in any instance of my environment.
The function would be:

CREATE OR REPLACE FUNCTION f_data_file (v_file_id NUMBER, v_sid varchar)
RETURN VARCHAR2 is v_file_name VARCHAR2 (256);
BEGIN   
    SELECT file_name 
    INTO   v_file_name
    FROM   sys.dba_data_files@v_sid
    WHERE  file_id = v_file_id;
    return v_file_name;
END f_data_file;

But when compile I receive the errors:
ORA-04052: error occurred when looking up remote object SYS.DBA_DATA_FILES@V_SID
ORA-00604: error occurred at recursive SQL level 1

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center