Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:34:25+00:00 2026-05-30T22:34:25+00:00

This is my first time asking my question at stackoverflow. I’m working on a

  • 0

This is my first time asking my question at stackoverflow. I’m working on a database project and I’m having some issues regarding inserting the data into my table. First here is the table that I created using this statement:

CREATE TABLE enrolls(
    uno NUMBER(5),
    eno NUMBER(5),
    startTime DATE,
    finishTime DATE,
    CONSTRAINT enrolls_pk PRIMARY KEY(uno, eno),
    FOREIGN KEY(uno) REFERENCES users(uno),
    FOREIGN KEY (eno) REFERENCES exam(eno)
);`

Here is the insert statement:

INSERT INTO enrolls(uno,eno,startTime,finishTime)
VALUES 
   (1,1,to_date('2012/02/15 10:00:00', 'yyyy/mm/dd hh24:mi:ss'),
        to_date('2012/02/22 10:00:00', 'yyyy/mm/dd hh24:mi:ss'));`

The error that I get is this:

"ORA-02291: integrity constraint (username.SYS_C0093024) violated - parent key
not found"

Based on a little research that I’ve done, the problem would be the way I put in the foreign key and I need two of them. How do I fix this error? What other way should I write two foreign keys for this? Please let me know. Thanks.

Edit1:
I used the CONSTRAINT on both of the foreign keys and when I inserted the same insert statement from above, it says that the error is coming from “uno”. Do you think there is something going on with the “users” table? Here is what I have for the users table:

CREATE TABLE users(
uno NUMBER(5), 
email VARCHAR2(64), 
password VARCHAR2(64), 
fname VARCHAR2 (64) NOT NULL, 
lname VARCHAR2 (64) NOT NULL, 
address1 VARCHAR2 (64), 
address2 VARCHAR2(64), 
city VARCHAR2(64), 
state VARCHAR2(64), 
zip NUMBER(5), 
CONSTRAINT users_pk PRIMARY KEY(uno)
);

One for exam:

CREATE TABLE exam(
eno NUMBER(5), 
etitle VARCHAR2(50), 
timeAllowed NUMBER (8), 
numberOfQuestionsPerPage NUMBER(3), 
CONSTRAINT exam_pk PRIMARY KEY(eno)
);

Is whatever that I did correct or am I doing something wrong here?

Edit2:
Alright, I think I figured out the problem. When I was checking my “users” table, apparently, the server from university that I’m using my SQL programming did not save the data that I’ve implemented in there. When I put the data again and implemented the the data for “enrolls”, it didn’t gave me an error. I think that was the problem to begin with. Also, how do I save my SQL stuff in UNIX so that this won’t happen again?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:34:26+00:00Added an answer on May 30, 2026 at 10:34 pm

    As far as I see, what is happening is that you are trying to insert foreign keys where the key does not exist in the other table(s). Is there a users row with a key of 1? Is there an exam row with a key of 1? If not for this error, referential integrity is broken.

    Or, maybe you built the relationships wrong, in which case you need to remove one or both of the FOREIGN KEY constraint(s) from the enrolls table

    UPDATE TO REFLECT YOUR UPDATE :):

    If the error is coming from the Users table, then that means that the value you are trying to submit for uno in the enrolls table does not exist in the uno table. You will need to add that to the users table first:

    INSERT INTO users VALUES (1, 'email', 'pw', 'fn', 'ln', 'add1', 'add2', 'city'
        , 'state', 'zip');
    

    Once this is done, you will now have a users record with an uno value of 1. Then your constraint will find the matching values and pass without error

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to Python and this is my first time asking a stackOverflow
First of all this is the first time I am asking a java question
First time using this service for a question. I hope I am not asking
This is my first time asking a question, please be gentle! I have a
I'm asking this question because it isn't the first time I saw this coding
this is my first time asking a question here so apologies if I am
First time asking a question here. Usually I can find my answer without having
this is my first time asking a question here so I hope I am
Well this is not the first time im asking these question here but I
This is my first time on stackoverflow asking questions so I will try my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.