gpt4 book ai didi

Oracle:函数的全局命名空间限定符?

转载 作者:行者123 更新时间:2023-12-04 16:55:20 32 4
gpt4 key购买 nike

我如何限定函数或过程调用以表明它
应该在全局范围内?我有自己的 scn_to_timestamp()
在需要调用默认全局函数的包中
同名。

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;

更新:事实证明,没有“全局”函数这样的东西,因为所有函数都存在于一个模式下。显示为全局的实际上是公共(public)同义词,因此您要做的就是在调用前加上导出函数的架构,在本例中:
        return sys.scn_to_timestamp(scn);

最佳答案

只需使用架构名称来引用全局。
我使用了架构所有者。

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;

关于Oracle:函数的全局命名空间限定符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1085102/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com