Проблема мой скрипт справка
Я думаю, что это действительно уникально для TaskId. Так не могли бы вы разгадать мой сценарий ?
Тут какая-то ошибка :
Inserting CR_job DATA INSERT INTO CR_job (TaskId, EmpId, HoursSpent) * ERROR at line 1: ORA-02291: integrity constraint (160767CI.CR_EMPLOYEEFK) violated - parent key not found INSERT INTO CR_job (TaskId, EmpId, HoursSpent) * ERROR at line 1: ORA-02291: integrity constraint (160767CI.CR_EMPLOYEEFK) violated - parent key not found INSERT INTO CR_job (TaskId, EmpId, HoursSpent) * ERROR at line 1: ORA-02291: integrity constraint (160767CI.CR_EMPLOYEEFK) violated - parent key not found INSERT INTO CR_job (TaskId, EmpId, HoursSpent) * ERROR at line 1: ORA-02291: integrity constraint (160767CI.CR_EMPLOYEEFK) violated - parent key not found 1 row created. 1 row created. INSERT INTO CR_job (TaskId, EmpId, HoursSpent) * ERROR at line 1: ORA-02291: integrity constraint (160767CI.CR_EMPLOYEEFK) violated - parent key not found 1 row created. INSERT INTO CR_job (TaskId, EmpId, HoursSpent) * ERROR at line 1: ORA-02291: integrity constraint (160767CI.CR_EMPLOYEEFK) violated - parent key not found Commit complete.
Во всяком случае, извините за мой плохой английский. Так что помоги мне Спасибо :)
Что я уже пробовал:
-- Spooling Prompts: CR_task Table PROMPT Creating CR_task Table create table CR_task ( TaskId char(4), TaskName varchar(25) NOT NULL, GivenDate date NOT NULL, StartDate date, EndDate date, MaxHours number(3,1) DEFAULT (20.0), Constraint CR_taskPK PRIMARY KEY (TaskId) );
-- Подсказки буферизации: таблица CR_job
Запрос на создание таблицы CR_job
создать таблицу CR_job
(
TaskId char(4) NOT NULL,
EmpId char(2) NOT NULL,
HoursSpent number(3,1) DEFAULT (20.0),
Ограничение первичного ключа CR_jobPK (Идентификатор_задачи, empid в),
Ограничение внешнего ключа CR_taskFK (Идентификатор_задачи) ссылки CR_task (Идентификатор_задачи),
Ограничение CR_employeeFK внешний ключ (EmpId) ссылки CR_employee (EmpId)
);
-- Spooling Prompts: CR_task inserts PROMPT Inserting CR_task DATA /* Insert into CR_task */ INSERT INTO CR_task (TaskId, TaskName, GivenDate, StartDate, EndDate, MaxHours) VALUES (1234, 'OS upgrade', '1-Feb-2016', '3-Feb-2016', '10-Feb-2016', '10'); /* Insert into CR_task */ INSERT INTO CR_task (TaskId, TaskName, GivenDate, StartDate, EndDate, MaxHours) VALUES (1235, 'Memory upgrade', '20-Feb-2016', '20-Feb-2016', '20-Feb-2016', '6'); /* Insert into CR_task */ INSERT INTO CR_task (TaskId, TaskName, GivenDate, StartDate, EndDate, MaxHours) VALUES (1236, 'Fault Analysis', '4-Mar-2016', '5-Mar-2016', '7-Mar-2016', '20'); /* Insert into CR_task */ INSERT INTO CR_task (TaskId, TaskName, GivenDate, StartDate, EndDate, MaxHours) VALUES (1237, 'Remove Virus', '15-Mar-2016', '16-Mar-2016', '20-Mar-2016', '40'); /* Insert into CR_task */ INSERT INTO CR_task (TaskId, TaskName, GivenDate, StartDate, EndDate, MaxHours) VALUES (1238, 'Printer repair', '8-Apr-2016', '10-Apr-2016', '', '20'); /* Insert into CR_task */ INSERT INTO CR_task (TaskId, TaskName, GivenDate, StartDate, EndDate, MaxHours) VALUES (1239, 'Cartridge replacement', '15-Apr-2016', '', '', '10');
-- Spooling Prompts: CR_job inserts PROMPT Inserting CR_job DATA /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1234, '01', '2'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1235, '08', '4'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1234, '07', '4'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1234, '09', '3'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1234, '10', '3'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1236, '12', '1'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1237, '01', '4'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1238, '12', '2'); /* Insert into CR_job */ INSERT INTO CR_job (TaskId, EmpId, HoursSpent) VALUES (1238, '04', '6');