ORA-02292: integrity constraint violated - child record found
OracleO que significa?
Uma linha pai foi excluída ou teve sua chave alterada, mas a constraint de foreign key não permitiu porque existem registros filhos dependentes.
Por que acontece?
Tentativa de DELETE de uma linha pai que tem registros na tabela filha; a FK está definida sem ON DELETE CASCADE; os registros dependentes não foram limpos antes.
Como resolver
Primeiro exclua os registros filhos dependentes ou mova-os para outro registro pai, depois exclua a linha pai. Se a regra de negócio permitir, recrie a foreign key com ON DELETE CASCADE: ALTER TABLE child DROP CONSTRAINT fk_name; ALTER TABLE child ADD CONSTRAINT fk_name FOREIGN KEY (my_column) REFERENCES parent(key_col) ON DELETE CASCADE; Para encontrar as linhas dependentes, consulte a tabela filha pela chave pai.
Mais entradas deste banco
- ORA-01438value larger than specified precision allowed for this column
- ORA-01400cannot insert NULL into (column)
- ORA-02291integrity constraint violated - parent key not found
- ORA-00979not a GROUP BY expression
- ORA-00918column ambiguously defined
- ORA-06550line/column PLS-... PL/SQL compilation error
- ORA-04068existing state of packages has been discarded