我在表中有一个约束
CREATE TABLE "USERSAPPLICATIONS" (
"USERID" NUMBER NOT NULL ,
"APPLICATIONNAME" VARCHAR2 (30) NOT NULL ,
CONSTRAINT "PK_USERSAPPLICATIONS" PRIMARY KEY ("USERID","APPLICATIONNAME")
)
/
两周前,我修改了表,添加了一些列,删除了约束“PK_USERSAPPLICATIONS”并添加了代理键。我可以在 Oracle SQL Developer 中看到约束 PK_USERSAPPLICATIONS 不再存在。
无论如何,当我尝试添加两个具有相同用户 ID/应用程序名称组合的条目时,我收到一个错误
SQL Error: ORA-00001: unique constraint (ACCOUNTMP1.PK_USERSAPPLICATIONS) violated
00001. 00000 - "unique constraint (%s.%s) violated"
*Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
For Trusted Oracle configured in DBMS MAC mode, you may see
this message if a duplicate entry exists at a different level.
*Action: Either remove the unique restriction or do not insert the key.
当我执行语句
SELECT *
FROM user_cons_columns
WHERE constraint_name = 'PK_USERSAPPLICATIONS'
我得到零行。怎么可能?Oracle 不应该对约束 PK_USERSAPPLICATIONS 有任何了解,因为它已经在几周前被删除,而且我在数据库中也看不到它。