我試圖使用SQL加載下面的表格。在我Ldirectory表我有SY
和LIDENTIFIER
作爲主鍵的組合,我試圖運行此查詢如何使用複合鍵加載表格
insert into S_User.LDIRECTORY (SY,LIDENTIFIER,ONAME,TELNUMBER)
select 2013,D.CODE, D.NAME, D_YEAR.PHONE_NUMBER
from WHS.D WHS.D_YEAR
where WHS.D.D_KEY=WHS.D_YEAR.D_KEY
和我收到的錯誤是:
SQL Error ORA-00001 unique constraint 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.
哪有我解決了這個問題?我認爲在插入期間,它將SY列作爲主鍵本身,但我對該列只有一個相同的值。
你可以顯示你的表創建語句嗎?您可能在'SY'和/或'LIDENTIFIER'(或另一列)上分別定義了一個唯一的約束。或者,或者您的選擇正在爲D.CODE – StevieG
返回重複值謝謝你的幫助 – user1751356