如何检查类型的依赖顺序以删除它们并替换/修改初始类型?
我尝试使用以下代码修改类型,但它给出了错误代码:“ORA-02303”。我对 Oracle 或 PL/SQL 不太了解,但我需要解决这个问题;所以我希望得到任何进一步的帮助。
提前致谢。该代码只是一个示例。但话又说回来,我需要先检查它的依赖者。
create or replace type A as object (
x_ number,
y_ varchar2(10),
member procedure to_upper
);
/
I tried to modify a type using the following code and it gave me the error code: 'ORA-02303'. I don't know much about Oracle or PL/SQL but I need to solve this; so I'd appreciate any further help with this.
Thanks in advance. The code is just an example. But then again, I need to check its dependents first.
create or replace type A as object (
x_ number,
y_ varchar2(10),
member procedure to_upper
);
/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据需要查看
DBA_DEPENDENCIES、ALL_DEPENDENCIES 或 USER_DEPENDENCIES
:Look in
DBA_DEPENDENCIES, ALL_DEPENDENCIES, or USER_DEPENDENCIES
as appropriate:不要将 DROP 与 FORCE 一起使用,因为它会自动修改表(删除列),天知道还有什么可以验证所有内容。
使用类似的内容:
这将适用于具有表/类型依赖性的类型。
Do not use DROP with FORCE, as it will automatically modify tables (delete columns) and god know what else to validate everything.
Use something like:
This will work on types with table/type dependencies.
如果您在表中使用过该类型,您应该能够通过如下查询查看它:
但我会首先查看 Alex 使用 ALTER TYPE 的建议
If you've used the type in a table you should be able to see it through a query like :
But I'd start off looking at Alex's suggestion of using ALTER TYPE
我确信它可以在数据字典中的某个地方找到,但不确定在哪里;并且您可能有很多不容易解决的依赖关系。但您也许可以修改现有类型: http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_4002.htm
还有一个
FORCE
选项,但仍然可能使依赖对象无效。I'm sure it's available in the data dictionary somewhere, but not sure where off-hand; and you're likely to have lots of dependencies that aren't easy to resolve. But you may be able to modify the existing type instead: http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_4002.htm
There's also a
FORCE
option but that could still invalidate dependent objects.这是由 Oracle 中的基本限制引起的,也是不在数据库中使用 oracle 类型的另一个原因。
对于“TYPE”依赖项,您可以:
注意:第 3..5 项是必需的,因为依赖类型无法自动重新编译或“就地”手动编译。
对于“TABLE”依赖项,您必须:
使用此处文章中的指南,其中讨论了三个相关场景。
ORA-02303:无法删除或替换具有类型或表依赖项的类型
来自 Oracle's Improbable Errors 博客
This is caused by basic restrictions in Oracle, another reason not to use oracle types in the database.
For 'TYPE' dependencies you can:
Note: The items 3..5 are required because dependent types cannot be automatically recompiled or manually compiled 'in place'.
For 'TABLE' dependencies you must:
Use the guidance in the article here, where it talks about the three relevant scenarios.
ORA-02303: cannot drop or replace a type with type or table dependents
from the Annals of Oracle's Improbable Errors blog