努力奔跑
INSERT INTO BOOKING_EXTRAS (BOOKING_ID, EXTRAS_, EXTRAS_PRICE) VALUES ('1','Phone call: 1.80','1.8');
在 Oracle SQL Developer 中。我让它运行但是当我关闭它然后重新打开它时我得到这个错误:
Error starting at line 1 in command:
INSERT INTO BOOKING_EXTRAS (BOOKING_ID, EXTRAS_, EXTRAS_PRICE) VALUES ('1','Phone call: 1.80','1.8')
Error report:
SQL Error: ORA-00001: unique constraint (COURSEWORK_XE.BOOKING_EXTRAS_PK) 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.
我该如何解决这个问题?它发生在我经营的每张 table 上!
最佳答案
您需要清除表或插入新信息,数据库不想要重复的行,因为这使得以后无法找到正确的行。
关于sql - 插入语句试图包含重复键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19817731/