sql - ORA-02291 Integrity Constraint Error -
sql - ORA-02291 Integrity Constraint Error -
i'm new sql; i'm trying populate created tables sample info whenever executes error message:
error starting @ line 1 in command: insert client (customerid, accountid, customertype, customerstatus) values (123485, 227482, 'residential', 'eligible') error report: sql error: ora-02291: integrity constraint (t31833821.sys_c0041532) violated - parent key not found 02291. 00000 - "integrity constraint (%s.%s) violated - parent key not found" *cause: foreign key value has no matching primary key value. *action: delete foreign key or add together matching primary key*.
below code used create table of client (i've created table accountid, , they're both empty).
create table client ( customerid number not null, accountid number(20) not null, customertype varchar(10) not null, customerstatus varchar(10) not null, constraint customer_pk primary key (customerid), constraint check_customer_status check(customerstatus in ('ineligible', 'eligible')), constraint check_customer_type check(customertype in ('nonresident', 'residential')) );
i've attempted found foreign key , insert sample data, aforementioned error kept appearing.
alter table client add together foreign key (accountid) references account(accountid); insert client (customerid, accountid, customertype, customerstatus) values (123485, 227482, 'nonresidential', 'eligible');
anyway prepare this? i'm using oracle sql
sql oracle foreign-keys
Comments
Post a Comment