17,089
社区成员
发帖
与我相关
我的任务
分享
SQL> create unique index testidx on test(id,ename);
索引已创建。
SQL> insert into test(id) values(1);
已创建 1 行。
SQL> select * from test;
ID ENAME
---------- --------------------
1
SQL> create table t_test_index
2 (a number(10),
3 b number(10),
4 c number(10),
5 d number(10));
Table created
SQL> create unique index t_test_index1 on t_test_index(a,b,c);
Index created
SQL> insert into t_test_index values(null,1,2,3);
1 row inserted
SQL> insert into t_test_index values(null,1,2,3);
insert into t_test_index values(null,1,2,3)
ORA-00001: 违反唯一约束条件 (TDS.T_TEST_INDEX1)
SQL>
SQL> truncate table t_test_index;
truncate table t_test_index
ORA-00054: 资源正忙, 但指定以 NOWAIT 方式获取资源
SQL> truncate table t_test_index;
Table truncated
SQL> insert into t_test_index values(null,1,2,3);
1 row inserted
SQL> insert into t_test_index values(null,1,2,3);
insert into t_test_index values(null,1,2,3)
ORA-00001: 违反唯一约束条件 (TDS.T_TEST_INDEX1)
SQL> insert into t_test_index values(null,null,2,3);
1 row inserted
SQL> insert into t_test_index values(null,null,2,3);
insert into t_test_index values(null,null,2,3)
ORA-00001: 违反唯一约束条件 (TDS.T_TEST_INDEX1)
SQL> insert into t_test_index values(null,null,null,3);
1 row inserted
SQL> insert into t_test_index values(null,null,null,3);
1 row inserted
SQL>