Help With Table Creation
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Help With Table Creation

  1. #1
    Join Date
    Oct 2005
    Posts
    2

    Help With Table Creation

    I am very new to Oracle/SQL so please be patient.
    I keep getting the following errors while populating my table RentalOrder
    ORA-02291: integrity constraint violated - parent key not found
    I have already created the CreditCard table and used "select * from CreditCard" and it showed me the correct data that I loaded.

    CREATE TABLE RentalOrder (
    rentalOrderID NUMBER(15) NOT NULL,
    issueDate DATE DEFAULT SYSDATE NOT NULL,
    dueDate DATE,
    deliveryOption VARCHAR2(25),
    creditCardNo NUMBER(20),
    PRIMARY KEY(rentalOrderID),
    FOREIGN KEY(creditCardNo) REFERENCES CreditCard(creditCardNo)
    );

    Here is my RentalOrder.ctl file I am using to populate data with

    LOAD DATA
    INFILE *
    APPEND INTO TABLE RentalOrder
    FIELDS TERMINATED BY '|'
    (rentalOrderID, issueDate, dueDate, deliveryOption, creditCardNo)
    BEGINDATA
    1|03JAN2005|10JAN2005|NULL|532723698
    2|05JAN2005|12JAN2005|NULL|532122628
    3|11JAN2005|18JAN2005|NULL|512743658
    4|14JAN2005|21JAN2005|NULL|512543555
    5|15JAN2005|22JAN2005|NULL|511523525
    6|16JAN2005|23JAN2005|NULL|519523929
    7|16JAN2005|23JAN2005|NULL|517527927
    8|17JAN2005|24JAN2005|NULL|557027907
    9|18JAN2005|25JAN2005|NULL|507427801
    10|19JAN2005|26JAN2005|NULL|527827605


    Any help as to why I am getting the error would be great. Thanks!

    Here is the create table for CreditCard for reference:

    CREATE TABLE CreditCard (
    creditCardNo NUMBER(20) NOT NULL,
    company VARCHAR2(25),
    expireDate DATE,
    customerSSN NUMBER(9),
    PRIMARY KEY(creditCardNo),
    FOREIGN KEY(customerSSN) REFERENCES Customer(SSN)
    );

  2. #2
    Join Date
    Oct 2005
    Posts
    2

    Fixed it!

    To bad there isn't a ORA-00411: typing mistake (nosleep.SYS_Czzzz) violated - go to sleep and try again.


    Thanks for having the forum here!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width