本文介绍了问题我的脚本帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为它对TaskId来说真的很独特。所以你能解决我的剧本吗?



这里有一些错误:



I think it is really unique for TaskId. So could you solve up my script ?

Here some error :

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.





无论如何,抱歉我的英语不好。所以,帮帮我谢谢:)



我尝试过:





Anyway, Sorry for my bad English. So help me Thanks :)

What I have tried:

-- 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表

PROMPT创建CR_job表



创建表格CR_job



TaskId char(4)NOT NULL,

EmpId char(2) NOT NULL,

HoursSpent number(3,1)DEFAULT(20.0),

Constraint CR_jobPK PRIMARY KEY(TaskId,EmpId),

约束CR_taskFK FOREIGN KEY(TaskId)REFERENCES CR_task(TaskId),

约束CR_employeeFK FOREIGN KEY(EmpId)参考CR_employee(EmpId)

);





-- Spooling Prompts: CR_job table
PROMPT Creating CR_job Table

create table CR_job
(
TaskId char(4) NOT NULL,
EmpId char(2) NOT NULL,
HoursSpent number(3,1) DEFAULT (20.0),
Constraint CR_jobPK PRIMARY KEY (TaskId, EmpId),
Constraint CR_taskFK FOREIGN KEY (TaskId) REFERENCES CR_task (TaskId),
Constraint CR_employeeFK FOREIGN KEY (EmpId) REFERENCES 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');

推荐答案


这篇关于问题我的脚本帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 08:10