【第51题】【062题库】2019年OCP认证062考试新题

51题、choose one

The HR. DEPARTMENTS table is the parent of the HR. EMPLOYEES table. The EMPLOYEES .

DEPARTMENT_ID column has a foreign key constraint with the ON DELETE CASCADE option that refers to the DEPARTMENTS. DEPARTMENT_ID column. An index exists on the DEPARTMENTS. DEPARTMENT_ID column. A transaction deletes a primary key in the DEPARTMENTS table, which has child rows in the EMPLOYEES table.

Which statement is true?

A) The transaction acquires a table lock on the DEPARTMENTS table. This lock enables other sessions to query but not update the DEPARTMENTS table until the transaction on the DEPARTMENTS table is complete.

B) The transaction acquires a table lock on the EMPLOYEES table. This lock enables other sessions to query but not update the EMPLOYEES table until the transaction on the DEPARTMENTS table is complete.

C) Only the rows that are deleted in the DEPARTMENTS and EMPLOYEES tables are locked until the transaction on the DEPARTMENTS table is complete.

D) The transaction acquires a table lock only on the DEPARTMENTS table until the transaction is complete.

Answer:C

(解析:这道题的关键点就是ON DELETE CASCADE选项,如果把父表的主键删除(注意这里不是删除主键约束),那么子表相对应的行也会被删除,所以在删除父表主键的时候,子表是被锁住的,目的是同时要删除子表对应的行。因为oracle删除行时是基于行级的锁。试验证明是可以删除其它子表上的行。来自3组:1015267481)

猜你喜欢

转载自www.cnblogs.com/cnblogs5359/p/11089711.html