OCP-1Z0-052-V8.02-169题

169. You have two tables with referential integrity enforced between them. You need to insert data to the

child table first because it is going to be a long transaction and data for the parent table will be available in

a later stage, which can be inserted as part of the same transaction.

View the Exhibit to examine the commands used to create tables. 

Which action would you take to delay the referential integrity checking until the end of the transaction? 

A.Set the constraint to deferred before starting the transaction.

B.Alter the constraint to NOVALIDATE state before starting the transaction.

C.Enable the resumable mode for the session before starting the transaction.

D.Set the COMMIT_WAIT parameter to FORCE_WAIT for the session before starting the transaction.

Answer: A  

答案解析:

参考:http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_10003.htm#SQLRF55408

你有两个表,它们之间有参照完整性的约束。在同一个事务中,你需要先在子表中插入数据,然后再使父表变为可用。

从图上可知,orders表是子表,它的item_code列参照items表的iitem_code,但是题中是先在子表中插入数据,然后再让父表变为可用,在有外键约束的情况下,这样是不能插入的,所以,可以在执行事务前,设置约束延迟生效,即在事务提交时生效,即可。

Specify DEFERRED to indicate that the conditions specified by the deferrable constraint are checked when the transaction is committed.

The following statement checks three deferred constraints when the transaction is committed. This example fails if the constraints were specified to be NOTDEFERRABLE.

SET CONSTRAINTS emp_job_nn, emp_salary_min ,
   hr.jhist_dept_fk@remote  DEFERRED;


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值