需要更新 ALTER TYPE 对象
Need to update the ALTER TYPE object
我使用以下查询创建了一个名为 example1
的 TYPE object
。
create or replace type example1 as object
(emp_name varchar2(32)
,emp_location varchar2(32)
)
后来我尝试将变量emp_location
的长度改成varchar(36)
,我尝试了多种方法
ALTER TYPE Point ADD ATTRIBUTE emp_location varchar2(36) CASCADE;
我以以下对象结束。
create or replace type example1 as object
(emp_name varchar2(32)
,emp_location varchar2(32)
)
Alter type example1 modify attribute emp_location varchar(36) cascade
Alter type example1 modify attribute emp_location varchar2(37) cascade
ALTER TYPE example1 DROP ATTRIBUTE emp_location INVALIDATE
ALTER TYPE example1 ADD ATTRIBUTE emp_location varchar2(38) CASCADE
现在我要删除以下内容
Alter type example1 modify attribute emp_location varchar(36) cascade
Alter type example1 modify attribute emp_location varchar2(37) cascade
ALTER TYPE example1 DROP ATTRIBUTE emp_location INVALIDATE
ALTER TYPE example1 ADD ATTRIBUTE emp_location varchar2(38) CASCADE
我该怎么做?
" I wanted to change the emp_location varchar2(32) to emp_location varchar2(36)"
好吧,您发布的其中一行代码就是这样做的(在更正类型名称之后):
SQL> create or replace type example1 as object
2 (emp_name varchar2(32)
3 ,emp_location varchar2(32)
4 )
5 /
Type created.
SQL> alter type example1 modify attribute emp_location varchar2(36) cascade
2 /
Type altered.
SQL> desc example1
Name Null? Type
----------------------------------------- -------- ----------------------------
EMP_NAME VARCHAR2(32)
EMP_LOCATION VARCHAR2(36)
SQL>
我使用以下查询创建了一个名为 example1
的 TYPE object
。
create or replace type example1 as object
(emp_name varchar2(32)
,emp_location varchar2(32)
)
后来我尝试将变量emp_location
的长度改成varchar(36)
,我尝试了多种方法
ALTER TYPE Point ADD ATTRIBUTE emp_location varchar2(36) CASCADE;
我以以下对象结束。
create or replace type example1 as object
(emp_name varchar2(32)
,emp_location varchar2(32)
)
Alter type example1 modify attribute emp_location varchar(36) cascade
Alter type example1 modify attribute emp_location varchar2(37) cascade
ALTER TYPE example1 DROP ATTRIBUTE emp_location INVALIDATE
ALTER TYPE example1 ADD ATTRIBUTE emp_location varchar2(38) CASCADE
现在我要删除以下内容
Alter type example1 modify attribute emp_location varchar(36) cascade
Alter type example1 modify attribute emp_location varchar2(37) cascade
ALTER TYPE example1 DROP ATTRIBUTE emp_location INVALIDATE
ALTER TYPE example1 ADD ATTRIBUTE emp_location varchar2(38) CASCADE
我该怎么做?
" I wanted to change the emp_location varchar2(32) to emp_location varchar2(36)"
好吧,您发布的其中一行代码就是这样做的(在更正类型名称之后):
SQL> create or replace type example1 as object
2 (emp_name varchar2(32)
3 ,emp_location varchar2(32)
4 )
5 /
Type created.
SQL> alter type example1 modify attribute emp_location varchar2(36) cascade
2 /
Type altered.
SQL> desc example1
Name Null? Type
----------------------------------------- -------- ----------------------------
EMP_NAME VARCHAR2(32)
EMP_LOCATION VARCHAR2(36)
SQL>