Home » SQL & PL/SQL » SQL & PL/SQL » ora 02291
ora 02291 [message #1119] Tue, 02 April 2002 19:04 Go to next message
Tarik
Messages: 3
Registered: April 2002
Junior Member
I keep on getting this error message if it's any help here is the table and the insert statement

First Table
Create TABLE Manager
(name VARCHAR2(35),
PASSWORD1 varchar2(10),
password2 VARCHAR2(10),
CONSTRAINT Manager_name_pk PRIMARY KEY(name));

Second table
Create TABLE SubProject
(year CHAR(4),
quarter VARCHAR2(6),
projectNo VARCHAR2(10),
subProjectNo VARCHAR2(4),
subContractName VARCHAR2(40),
subProjectOffice VARCHAR2(20),
manager VARCHAR2(35) CONSTRAINT SubProject_manager_nn NOT NULL,
manager2 VARCHAR2(35),
EvaluationTemplate CLOB,
CONSTRAINT SubProject_pk PRIMARY KEY (year, quarter, projectNo, subProjectNo),
CONSTRAINT SubProject_manager_fk FOREIGN KEY (manager) REFERENCES Manager(name),
CONSTRAINT SubProject_manager2_fk FOREIGN KEY (manager2) REFERENCES Manager(name));

insert statement
insert INTO SubProject VALUES
(2002, 1 , 213, 1, 'River Road Development', 'Houston', 'Tarik Blunt', ' ', ' ');
insert INTO SubProject VALUES
*
ERROR at line 1:
ORA-02291: integrity constraint (S011.SUBPROJECT_MANAGER2_FK) violated - parent
key not found
Re: ora 02291 [message #1122 is a reply to message #1119] Tue, 02 April 2002 21:32 Go to previous messageGo to next message
Epe
Messages: 99
Registered: March 2002
Member
Hello,

you are trying to insert a value in the field "manager2" ('') in the "SubProject" table that doesn't exist in the "manager" table. In this example it's not possible to insert a record in the "SubProject" table with an empty "manager" or "manager2" field, because they have to exist in the "manager" table in the field "name" (due to the foreign key "subproject_manager2_fk"), which is a primary key (so can't be null)...

Hopefully clearer now,

epe
Re: ora 02291 [message #1831 is a reply to message #1119] Mon, 03 June 2002 05:30 Go to previous message
Nancy
Messages: 19
Registered: March 2002
Junior Member
Hello,

Create the manager in the table manager before trying to insert a record in the table subproject. If you don't want to do this, make the column manager optional.

Nancy.
Previous Topic: Re: Can we use PL/SQL key words as Coloumn Names
Next Topic: static data and dynamic data
Goto Forum:
  


Current Time: Fri Apr 19 00:44:19 CDT 2024