为什么 Oracle SQL Developer 中的包和视图有时即使在编译时也会出现错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3104763/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:54:12  来源:igfitidea点击:

Why do packages and views in Oracle SQL Developer sometimes appear to have errors even when they compile?

oraclepackagesoracle-sqldeveloper

提问by aw crud

Sometimes when I browse views or packages in Oracle SQL Developer they have a red icon next to them, indicating that there was a compile error. This seems to randomly happen to objects that compile without any errors or warnings.

有时,当我在 Oracle SQL Developer 中浏览视图或包时,它们旁边会出现一个红色图标,表明存在编译错误。这似乎随​​机发生在编译时没有任何错误或警告的对象上。

They continue to work even with the red icon, but it's confusing and makes me wonder if I'm missing something. What can I do to find out why these objects are being marked as having problems?

即使使用红色图标,它们也可以继续工作,但这很令人困惑,让我怀疑我是否遗漏了什么。我该怎么做才能找出为什么这些对象被标记为有问题?

回答by ring bearer

I have seen the same; most of the time when a sub procedure was modified and required compilation.

我也看到过;大多数时候,子过程被修改并需要编译。

回答by bert

Oracle SQL Developer is not the finest bit of SW engineering. In general i think oracle should just do what they can do good, that is databases ;) Only saying this to indicate that i would not worry to much about such glitches.

Oracle SQL Developer 并不是软件工程中最好的部分。总的来说,我认为 oracle 应该做他们能做的好事,那就是数据库;) 这么说只是为了表明我不会太担心这些故障。

I have not seen that problem myself, but i could imagine that this happens when a database object (e.q a table) this package is using has been altered. Even through the package still compiles, oracle somehow marks them. In jdbc, you would get an 'existing state of package has been discarded' message on the first call to the package. Just a guess, it might just be an error, i would not wonder to much, looking at the quality of their java products in general ;)

我自己没有看到这个问题,但我可以想象当这个包使用的数据库对象(如表)被改变时会发生这种情况。即使通过包仍然编译,oracle 以某种方式标记它们。在 jdbc 中,您会在第一次调用包时收到“包的现有状态已被丢弃”消息。只是一个猜测,它可能只是一个错误,我不会想太多,一般看他们的 Java 产品的质量;)

回答by redcayuga

Oracle will recompile invalid packages on the fly - that's why invalid packages will often work properly.

Oracle 将即时重新编译无效包 - 这就是无效包通常可以正常工作的原因。

As others have pointed out, packages will become invalid if any referenced object is altered. The package may or may not compile cleanly - it depends on how the object is altered.

正如其他人指出的那样,如果任何引用的对象被更改,包将变得无效。包可能会也可能不会干净地编译 - 这取决于对象的更改方式。