Hi folks,
I've two tables as below shows:
*****************************************************************
Create table SCOTT.T61_11
(
ID Number,
COL1 char(100) invisible,
COL2 Varchar2(1100) invisible,
Constraint T61_11_Uniq_COL2 UNIQUE(COL2) DEFERRABLE
);
Insert Into SCOTT.T61_11 (id,col1,col2) Values(1,'garçon','garçon');
Insert Into SCOTT.T61_11 (id,col1,col2) Values(2,'tempête','tempête');
Insert Into SCOTT.T61_11 (id,col1,col2) Values(3,'a','a');
commit;
Create table SCOTT.T11
(
ID Number,
COL1 char(20) ,
COL2 Varchar2(20) ,
Constraint T11_Uniq_COL2 UNIQUE(COL2) DEFERRABLE
);
Insert Into SCOTT.T11 (id,col1,col2) Values(1,'garçon','garçon');
Insert Into SCOTT.T11 (id,col1,col2) Values(2,'tempête','tempête');
Insert Into SCOTT.T11 (id,col1,col2) Values(3,'a','a');
commit;
***************************************************************************
Then I tried to disable these two constraints like:
alter table SCOTT.T61_11 disable constraint T61_11_Uniq_COL2;
alter table SCOTT.T11 disable constraint T11_Uniq_COL2;
And then I enable these two constraints:
alter table SCOTT.T61_11 enable constraint T61_11_Uniq_COL2;
alter table SCOTT.T11 enable constraint T11_Uniq_COL2;
At this time, when I execute SQL like:
Insert Into SCOTT.T61_11 (id,col1,col2) Values(3,'a','a');
Insert Into SCOTT.T11 (id,col1,col2) Values(3,'a','a');
What result should I suppose to get? I assume that I cannot insert these two lines successfully since we have already enable the constraints.
But the result shows that in SCOTT.T11,it would raise "ORA-00001:unique constraint (%s.%s) violated" while in SCOTT.T61_11, the data can be inserted into table successfully. This makes me confused.
Can anyone help to explain how could this happen, please? Thanks.