-
Inserting of date values
Hi, i wonder if anyone can help me. I've created some tables and i would like to enter some data into them, they go ok into the first and second tables fine, but in the third for the date value it continues to bring up errors!
Code:
Table 1
CREATE TABLE JDcustomers
(crefno NUMBER(4) NOT NULL,
cname VARCHAR2(20) NOT NULL,
cadd1 VARCHAR2(20) NOT NULL,
cdd2 VARCHAR2(20),
PRIMARY KEY (crefno));
Table 2
CREATE TABLE JDvehicles
(regno VARCHAR2(7) NOT NULL,
v_crefno NUMBER(4) NOT NULL,
PRIMARY KEY (regno),
FOREIGN KEY(v_crefno) REFERENCES customers(crefno));
Table 3
CREATE TABLE JDrepairs
(jobcode NUMBER(6) NOT NULL,
regno VARCHAR2(7) NOT NULL,
datein DATE NOT NULL,
finish DATE,
bayno NUMBER(2) NOT NULL,
PRIMARY KEY (jobcode),
FOREIGN KEY(regno) REFERENCES vehicles);
Insert into table 1
INSERT INTO JDcustomers
VALUES ('4444','INDUSTRIAL CLEANING','97 PARK ROAD','SOUTHAMPTON');
INSERT INTO JDcustomers
VALUES ('5555','FORK TRUCK SERVICES','28 CASTLE STREET','WINCHESTER');
Insert into table 2
INSERT INTO JDvehicles
VALUES ('HG07VEB',4444);
INSERT INTO JDvehicles
VALUES ('HB57DIW',4444);
INSERT INTO JDvehicles
VALUES ('HF57NAR',4444);
INSERT INTO JDvehicles
VALUES ('HF57RST',4444);
INSERT INTO JDvehicles
VALUES ('RK06TEC',5555);
INSERT INTO JDvehicles
VALUES ('RK56ADI',5555);
INSERT INTO JDvehicles
VALUES ('RN56UME',5555);
INSERT INTO JDvehicles
VALUES ('RD56SPE',5555);
Insert into table 3INSERT INTO JDrepairs
VALUES (139087,'RK06TEC','03-APR-08','06-APR-08',15);
INSERT INTO JDrepairs
VALUES (139587,'HG07VEB','10-APR-08','11-APR-08',11);
INSERT INTO JDrepairs
VALUES (140187,'HB57DIW','13-APR-08',,04);
INSERT INTO JDrepairs
VALUES (139987,'RK56ADI','05-MAY-08','10-MAY-08',12);
INSERT INTO JDrepairs
VALUES (140387,'HF57NAR','16-MAY-08',,15);
INSERT INTO JDrepairs
VALUES (140087,'RN56UME','09-MAY-08','14-MAY-08',01);
INSERT INTO JDrepairs
VALUES (140287,'RD56SPE','02-APR-08','03-APR-08',11);
These are the errors it produces;
Code:
INSERT INTO JDrepairs
*
ERROR at line 1:
ORA-02291: integrity constraint (AUSER.SYS_C00977449) violated - parent key not found
VALUES (140187,'HB57DIW','13-APR-08',,04)
*
ERROR at line 2:
ORA-00936: missing expression
Can anyone help me please?
Last edited by Drewery86; 03-25-2008 at 01:09 PM.
-
Code:
ORA-02291: integrity constraint (AUSER.SYS_C00977449) violated - parent key not found
Something is wrong either with your data or with your objects.
Take a look at your DDL to create Table #2 and #3... does anything looks funny?
Check your constraints, look at where are they pointing.
Remember to commit your job.
Last edited by PAVB; 03-25-2008 at 01:34 PM.
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
erm, i don't see anything wrong with it! :S
-
Your FKs are referencing costumers and vehicles tables; what are the names of your tables?
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
ahh i se it, thank you for your help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|