10g 包构造 - 限制引用
我正在构建一个相当大的 Oracle 10g 包,其中充满了函数等。
问题是其中一些函数正在从其他函数正在创建的物化视图或表中提取信息。
有没有一种方法可以成功编译包,即使某些函数无法找到它们正在查找的信息(但是一旦创建了视图,这些函数就可以工作?)。
尝试: 我已经研究过PRAGMA RESTRICT_REFERENCES
,但到目前为止还没有成功。我是否走在正确的轨道上,或者这根本不可能?
I am constructing a rather large Oracle 10g package full of functions etc.
The problem is some of these functions are pulling information from materilized view's or tables that other functions are creating.
Is there a way to successfully compile a package even though some of the functions cannot find the information they are looking for (But these functions will work once the views have been created?).
Attempts:
I have looked into PRAGMA RESTRICT_REFERENCES
but have had no success so far. Am I even on the right track or is this not even possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能使用静态 SQL 来引用编译代码时不存在的对象。你对此无能为力。
您需要修改代码以使用动态 SQL 来引用在运行时创建的任何对象。您可能可以使用 EXECUTE IMMEDIATE,即,而
不是
说,但是,我对涉及在运行时创建任何新表和物化视图的 PL/SQL 实现非常怀疑。这在 Oracle 中几乎总是一个错误。为什么需要在运行时创建新对象?
You cannot refer using static SQL to objects that do not exist when the code is compiled. There is nothing you can do about that.
You would need to modify your code to use dynamic SQL to refer to any object that is created at runtime. You can probably use
EXECUTE IMMEDIATE
, i.e.rather than
That being said, however, I would be extremely dubious about a PL/SQL implementation that involved creating any new tables and materialized views at runtime. That is almost always a mistake in Oracle. Why do you need to create new objects at runtime?