views:

204

answers:

1

How do I qualify a function or procedure call to indicate that it should be at global scope? I have my own scn_to_timestamp() in a package that needs to call the default global function of the same name.

create or replace package px as
    function scn_to_timestamp(scn number) return timestamp;
end px;

create or replace package body px as
    function scn_to_timestamp(scn number) return timestamp is
    begin
        -- how do I qualify this to refer to the global function?
        return scn_to_timestamp(scn);
    end;
end px;

update: It turns out there's no such thing as a "global" function, since all functions exist under a schema. What appears as a global is actually a public synonym, so all you have to do is prefix the call with the schema that exported the function, in this case:

        return sys.scn_to_timestamp(scn);
+2  A: 

Just use the schema name to refer to the global. I used the schema owner.

create or replace package px as
    function scn_to_timestamp(scn number) return timestamp;
end px;

create or replace package body px as
    function scn_to_timestamp(scn number) return timestamp is
    begin
        -- how do I qualify this to refer to the global function?
        return sys.scn_to_timestamp(scn);
    end;
end px;
Todd Pierce
thanks. scn_to_timestamp is owned by sys, so I updated to reflect.
Mark Harrison