| Author |
problem while inserting values
|
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
my databe table structure is as follows name ssn address salary superssn ok here foreign key is superssn and reference is also in the same table. so while inserting values am getting ORA-02291: error how do i resolve this??
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
superssn is referring ssn so not able to insert any values at all
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32715
|
|
I think this thread would sit more happily in another forum . . . Please provide more details about your insert statement or whatever. What is "ssn"? What type of variable is it, and also superssn? Which is the primary key in your table.
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
ssn is a varchar superssn is also varchar primary key is ssn sorry for posting it here. i didnt find any sql forum here in javaranch.
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
superssn is the foreign key so am not able to insert any values when i try to insert values it will not the superssn value for example say ssn is 1 and superssn is 2 in the first insert .then since 2 is not available at that point . it shows error. but how do i solve this. some values has to be entered right?
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16696
|
|
sorry for posting it here. i didnt find any sql forum here in javaranch
Posting to the right forum is a two-way street. You stand a much better chance of having people who can answer your question if you do. You are kinda wasting your time by posting to any random forum. Regardless, the closest forum for this, is probably the JDBC forum, which hopefully, this topic will be moved to. Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32715
|
|
|
Please provide full details of the table, and the insert statement.
|
 |
Heather Rose
Ranch Hand
Joined: Aug 25, 2008
Posts: 54
|
|
|
What exactly does your error say? And please provide details on exactly what you are trying to do.
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
hi this is my create query [ September 08, 2008: Message edited by: yuvraj kotegar ]
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
table gets created ok then when i try to insert values i get the following error ORA-02291: integrity constraint (SYSTEM.SYS_C003019) violated - parent key not found how to insert atleast one record??
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32715
|
|
You have got the concept that you are inserting a row with a reference to a previous row; the very 1st row cannot refer to other rows, so it either must refer to itself, or to nothing. For the 1st row use "null" for superssn or use its own value. If you have designed your table that it not only contains the employee's name but also their supervisor's id, then you are designing a "tree" inside the table ( ) and you ought to have a separate supervisor table. [ September 09, 2008: Message edited by: Campbell Ritchie ]
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
this is the solution guys
|
 |
yuvraj kotegar
Ranch Hand
Joined: Jul 31, 2008
Posts: 120
|
|
Thanks people for all your time and help :thumb:
|
 |
 |
|
|
subject: problem while inserting values
|
|
|