Re: Foreign Key Problems

From: Gary Smith <smithg2_at_iia.org>
Date: 8 Aug 1994 17:09:15 GMT
Message-ID: <325orr$kjt_at_ankh.iia.org>


Oracle 6.0 does not enforce foreign key constraints; this must be done within the application (Forms triggers, PL/SQL blocks, etc.). Oracle 7.0 *does* enforce foreign key constraints.



Greg Grieff (ggrieff_at_netcom.com) wrote:
: 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." |
: -------------------------------------------------------------------------

--
=================================================================
Gary T. Smith                | My opinions are strictly my own.
smithg2_at_iia.org              |
=================================================================
Received on Mon Aug 08 1994 - 19:09:15 CEST

Original text of this message