constraint deferrable immediate check
-- define a deferrable constraint allow check constraint when a transaction is commited, by default with immediate constraint allow check constraint after DML operation .
-- allow primary key check deferrable.
alter table t1 add constraint pk_t1 primary key (id) initially deferred ;
insert into t1 (id) values (1) ;
insert into t1 (id) values (1) ;
commit ; -- report error here.
-- allow foreign key check deferrable.
alter table t2 add constraint fk_t2_t1 foreign key (dept_id) referencing t1
initially deferred ;
insert into t2 (id,dept_id) values (1,999) ;
commit ; -- report error here.
-- switch constraint check at which points.
alter session set constraint=deferrable ;
set constraints all deferrable /immediate;
set constraint pk_t1 deferrable /immediate;
[@more@]來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/350519/viewspace-1042712/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Constraint deferrable特性研究AI
- Deferred Constraint CheckAI
- not null constraint和check constriant的問題及分析NullAI
- 約束的DEFERRABLE and DEFERRED特性
- ConstraintAI
- EXECUTE IMMEDIATE dynamic sql in procedureSQL
- zt_Resolving Shutdown Immediate Hang Situations_shutdown immediate關庫慢
- 約束CONSTRAINTAI
- constraint約束AI
- Unused&ConstraintAI
- execute immediate 語法小結
- initially immediate 與 initially deferred
- onclick="return check()" 和 onclick="check()" 區別
- constraint=constraints?AI
- execute immediate的簡單用法(oracle)Oracle
- BCSphere入門教程01:Immediate Alert
- EXECUTE IMMEDIATE 呼叫動態過程
- Could not resolve com.android.support.constraint:constraint-layout:1.1.3AndroidAI
- EXECUTE IMMEDIATE 儲存過程中 許可權不足及EXECUTE IMMEDIATE的除錯避坑儲存過程除錯
- Will attempt to recover by breaking constraintAI
- CONSTRAINT的用法舉例AI
- Deferring Constraint ChecksAI
- transactional replication 的immediate_sync屬性
- 儲存過程中慎用 execute immediate儲存過程
- Oracle動態執行語句(Execute Immediate)Oracle
- 動態 SQL、EXECUTE IMMEDIATE、using、into、returningSQL
- EXECUTE IMMEDIATE動態SQL的使用總結SQL
- shutdown immediate 太慢,需要進行程式查殺行程
- 資料庫無法shutdown immediate的案例資料庫
- 複習execute immediate動態sql語法SQL
- MySQL——約束(constraint)詳解MySqlAI
- 討論關於Constraint statesAI
- check_document_position
- type check例題
- WITH CHECK OPTION 詳解
- Using the WITH CHECK OPTION
- Check database status in RACDatabase
- [Oracle Script] check userOracle