Oracle管理

ORA-02303:无法使用类型或表的相关性来删除或取代一个类型

时间:2013/7/8 14:48:24  作者:说歌社区  来源:www.solgle.com  查看:3290  评论:0
内容摘要:ORA-02303 cannot drop or replace a type with type or table dependent(s)Cause An attempt was made to drop or replace a type that has dependen...

ORA-02303 cannot drop or replace a type with type or table dependent(s)

Cause An attempt was made to drop or replace a type that has dependents.
Action Drop all type(s) and table(s) depending on the type, then retry the operation or use the FORCE option.

-------------------------------------------------------------

在11.2中,Oracle增强了TYPE类型的依赖处理。
 

在以前的版本中,如果表或另一个对象依赖当前的对象,那么这个对象是无法CREATE OR REPLACE的,在11.2中,这个限制被放宽,当依赖当前对象的对象是对象时,允许使用CREATE OR REPLACE FORCE来重建对象;如果依赖当前对象的对象是表,则新增的CREATE OR REPLACE FORCE功能也是无效的。

SQL> select * from v$version;

BANNER
{p%_ y9w!W y0--------------------------------------------------------------------------------
t Uw~1cM:e4Av0Oracle Database11gEnterprise Edition Release11.2.0.1.0 - 64bit Production
2RN4[ZBF ZF0PL/SQL Release 11.2.0.1.0 - Production
n FM"A A)[YG0CORE 11.2.0.1.0 Production
[n8@%g(U0TNS for Linux: Version 11.2.0.1.0 - Production
1v W L5`&w T0NLSRTL Version 11.2.0.1.0 - Production

SQL> create type t_id_tab is table of number(10);

类型已创建。

SQL> create type t_id_tab_tab is table of t_id_tab;

类型已创建。

SQL> create or replace type t_id_tab is table of number(20);
create or replace type t_id_tab is table of number(20);
第1行出现错误:
0ORA-02303:无法使用类型或表的相关性来删除或取代一个类型


SQL> create or replace type t_id_tab force is table of number(20);

类型已创建。

SQL> drop type t_id_tab;

ORA-02303:无法使用类型或表的相关性来删除或取代一个类型


SQL> drop type t_id_tab force;

类型已删除。

SQL> drop type t_id_tab_tab;

类型已删除。

可以看到使用FORCE功能可以避免当前的TYPE被其他对象所依赖后而无法重建或删除。不过这种依赖仅限于对象之间,如果依赖对象的是表,则FORCE功能不起作用:

SQL> create type t_type as object
2 (id number,
3 name varchar2(30));
4 /

类型已创建。

SQL> create table t_type_tab of t_type;

表已创建。

SQL> create or replace type t_type as object
2 (id number(5),_
3 name varchar2(30));
4 /
create or replace type t_type as object

第1行出现错误:
0ORA-02303:无法使用类型或表的相关性来删除或取代一个类型

SQL> create or replace type t_type force as object
2 (id number(5),
3 name varchar2(30));
4 /

create or replace type t_type force as object

第1行出现错误:
ORA-22866:无法替换具有表相关性的类型

 

标签:ORA-02303 无法使用类型或表的相关性来删除或取代一个类型 

出处:solgle
网址:www.solgle.com
相关文章
    相关评论
     img1 img2 img3 img4 img5 img6 img7 img8 img9 img10
    评论者:      验证码:  点击获取验证码
       Copyright © 2013-2028 solgle.com,All rights reserved.[solgle.com] 公安机关备案号:51010802000219
    Email:solgle@solgle.com; weixin:cd1008610000 ICP:蜀ICP备14011070号-1