无法在oracle中更改对象表类型

时间:2015-02-25 20:32:08

标签: oracle object types alter

create or replace type try_object as object(
    my_name varchar2(10),
    roll number
);
/

create or replace type try_object_tab as table of try_object;
/

alter type try_object modify attribute (my_name varchar2(5)) cascade;

执行上述行后,我收到此错误

Error starting at line : 27 in command -
alter type try_object modify attribute (my_name varchar2(5)) cascade
Error report -
SQL Error: ORA-22324: altered type has compilation errors
ORA-22328: object "TRIJIT"."TRY_OBJECT" has errors.
PLS-00719: only widening of attribute 'MY_NAME' constraints is allowed
ORA-06550: line 0, column 0:
PL/SQL: Compilation unit analysis terminated
22324. 00000 -  "altered type has compilation errors"
*Cause:    The use of the ALTER TYPE statement caused a compilation error.
*Action:   Correct the error reported and resubmit the statement.

我想知道当我完全遵守oracle文档时错误到底是什么。有人可以帮我解决这个问题吗?感谢..

1 个答案:

答案 0 :(得分:0)

您尝试删除并添加属性吗?

ALTER TYPE try_object DROP ATTRIBUTE my_name;
ALTER TYPE try_object ADD ATTRIBUTE my_name varchar2(5);