Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Primary Key - Foreign Key Problem

Author  Topic 

prakashdotc
Starting Member

25 Posts

Posted - 2007-01-25 : 02:06:06
Hi all,

I'm using Oracle 9i, here i have a Master Table and Child Table, Master Tables Primary key (OFNO)-(Order Form Number) is Foreign key for Child Tables (OFNO), The entries in Master table may open i.e creates OFNO dynamically, some times may be Internal one which has '0' as OFNO. After making an internal order i try to make entry for Child Table, but it throws this error "ORA-02291: integrity constraint ... violated - parent key not found" - i know the reason for this error. but the issue is even though there is no entry in Master table for the particulare OFNO i have to make entry in Child table, that's it. i think i'm clear with my problem, if not please raise queries, and thank's in advance for your reply's

- Prakash.C

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-25 : 02:49:50
Since there is a PK/FK relationship, you can't...
One workaround is to permanently add a record in Master table with OFNO set to zero, and have an identity on the Child table.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -