2016-09-12 17 views
0

整合性制約のエラーを得たが、それは次のエラー表示です:私は、SQLデータベースからいくつかのアイテムを削除しようとしましたが、私はSQLデータベースからいくつかの行を削除するには、次のクエリを試してみました

問合せ:

Delete From Document_Type where Doc_Type_id='case' 

これはエラーです:

Error starting at line : 4 in command - 
delete From Document_Type where Doc_Type_Desc='Case' 


Error report - 
SQL Error: ORA-02292: integrity constraint (NW_DEV_281015.FK_COMMENTS_DOCUMENT_TYPE6) violated - child record found 
02292. 00000 - "integrity constraint (%s.%s) violated - child record found" 

*Cause: attempted to delete a parent key value that had a foreign dependency. 

*Action: delete dependencies first then parent or disable constraint. 

解決する方法この問題

答えて

1

オラクルはエラーとみなします。

エラーメッセージのように、子テーブルを強制的に接続するという制約があります。最初に、子テーブルから同じレコードを削除します。

DELETE FROM Child_Table t 
WHERE t.<FK> IN(SELECT s.PK FROM Document_Type s where s.Doc_Type_Desc='Case') 

次に削除します。あるいは、制約を無効にしてください。

alter table 
    table_name 
DISABLE constraint 
    constraint_name; 
+0

ありがとうございます。 –

関連する問題