为什么我会
Error report:
SQL Error: ORA-02291: integrity constraint (FAUZI.NIL_NIM_FK) violated - parent key not found
02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found"
*Cause: A foreign key value has no matching primary key value.
*Action: Delete the foreign key or add a matching primary key. ?
这是数据库表的结构:
alter table nilai
add
(
constraint nil_kd_makul_fk foreign key(kd_makul) references
makul(kd_makul),
constraint nil_nim_fk foreign key(nim) references mahasiswa(nim)
on delete cascade
)
插入makul
选择' A1',' Jarkom',4,4来自双重
联合所有
选择' A2',' Keamanan Data',3,5来自双重
联合所有
选择' A3',' Jarkom 2',4,4来自双重
/
NAMA JURUSAN TGL_LAHIR JK ALAMAT STATUS NIM
------------------------------ ------------------------------ ------------------------- -- ------------------------------ -------------------- --------------------
mas mas SI 21-01-1994 123
fauzi TI 14-09-1991 124
zainn EKONOMI 03-03-2014
我得到错误,然后我写语法:
insert into nilai
select 'A1','123',60,70,80 from dual
union all
select 'A2','124',30,100,90 from dual
union all
select 'A3','125',40,80,70 from dual
/
错误:
Error report:
SQL Error: ORA-02291: integrity constraint (FAUZI.NIL_NIM_FK) violated - parent key not found
02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found"
*Cause: A foreign key value has no matching primary key value.
*Action: Delete the foreign key or add a matching primary key.