052-010題解析

pxbibm發表於2014-03-31
 

10.

Examine the following statement that is used to modify the constraint on the SALES table:

SQL> ALTER TABLE SALES MODIFY CONSTRAINT pk DISABLE VALIDATE;

Which three statements are true regarding the above command? (Choose three.)

A.The constraint remains valid.

B.The index on the constraint is dropped.

C.It allows the loading of data into the table using SQL *Loader.

D.New data conforms to the constraint, but existing data is not checked

E.It allows the data manipulation on the table using INSERT/UPDATE/DELETE SQL statements.

Answer: ABC

答案解析:

本題考的是表約束, 

DISABLE ENABLE 是針對新增的資料是否符合約束,NOVALIDATE VALIDATE是針對已經存在的資料是否符合約束。

? DISABLE NOVALIDATE

? DISABLE VALIDATE

? ENABLE NOVALIDATE

? ENABLE VALIDATE

--約束狀態:
enable validate: 啟用約束,預設就是validate,指
   校驗表中已存在的資料以及以後要插入的資料
enable novalidate:啟用約束,只校驗以後要插入的資料
disable validate:禁止約束,表將不允許dml操作,工具匯入資料可以
disable novalidate:禁止約束,預設就是novalidate
插入不合理資料
create table t06 (id number primary key,
name varchar2(20));

insert into t06 values(1,'a');
insert into t06 values(1,'b');

select * from user_constraints;
select * from user_indexes;

alter table t06 disable constraint SYS_C003795;
insert into t06 values(1,'a');
insert into t06 values(1,'b');
create index t06_idx on t06(id);
alter table t06 enable novalidate constraint SYS_C003795;
commit;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12798004/viewspace-1133257/,如需轉載,請註明出處,否則將追究法律責任。

相關文章