Foreign Key Problems
Date: Sun, 7 Aug 1994 14:02:37 GMT
Message-ID: <ggrieffCu64CD.7KM_at_netcom.com>
I must be missing something...please help?!
I would like to create two tables, a parent table and a child table such that the child table will only accept rows for insert if there is a valid parent record that it references. Basically the text book primary key - foreign key relationship. Following is my SQL code to create the two tables.
create table a (docid number(9) not null primary key,
lname char(8),
fname char(8))
/
create table b (imgid number(9) not null primary key,
docid number(9) not null references a (docid) constraint
docid_fk,
filename char(8),
sideid char(3))
/
Now when I attempt to insert a record into b it will allow be to regardless of whether a valid parent record in a exists. What am I missing? Any help would be greatly appreciated.
Thanks in advance,
-Greg
| Greg Grieff ggrieff_at_netcom.com | "Dream, Design, Develop, Debug, |
| Head of Engineering | Deliver... Not necessarily in |
| Micrographic Specialties Inc. | that order." |
Received on Sun Aug 07 1994 - 16:02:37 CEST