Error en ORA-02291 integrity constraint (SYSTEM.SYS_C005494) violated - primary key not found

165 views Asked by At

This is my code:

create table socio_recomendado(
cc_soc2 number(10) not null,
cc_socio_recomendado number(10) not null,
foreign key(cc_soc2)
references socio(cc_soc),
foreign key(cc_socio_recomendado)
references socio(cc_soc),
constraint C_SOC
check(cc_socio_recomendado != cc_soc2));

alter table socio_recomendado add primary key(cc_soc2,cc_socio_recomendado);

This is the code for Insert the value, but appears an error:

insert into socio_recomendado
values(1121955490,1121555490);
1

There are 1 answers

0
user8664682 On

The reference key refers to SOCIO table. While inserting the value in SOCIO_RECOMENDADO table, if the value is not found in SOCIO table it will give the ORA error you mentioned.

Please insert the value in SOCIO table first before inserting the value in SOCIO_RECOMENDADO table.