Subject RE: [IBO] Foregn Key Problem
Author Helen Borrie
Jack,

At 07:18 PM 6/06/2003 -0400, you wrote:
>DDL for the referred table:

Before looking further, would you look at the DDL below and check whether
you have provided the right definitions. The foreign key definition links
INKIND to a table named CONTRIBUTIONS, which you don't show here.

Helen


>RECREATE TABLE CONTRIBUTORS
>(
> CONTRIBUTORNR INTEGER NOT NULL,
> CONTRIBUTORTYPE CHAR( 20) CHARACTER SET
>NONE COLLATE NONE,
> DATEENROLLED DATE,
> NAME CHAR( 50) CHARACTER SET
>NONE COLLATE NONE,
> NOTES VARCHAR( 10000) CHARACTER SET
>NONE COLLATE NONE
>);
>
>DDL for the referring table:
>
>RECREATE TABLE INKIND
>(
> INKINDNR INTEGER NOT NULL,
> CONTRIBUTIONNR INTEGER,
> DESCRIPTION CHAR( 100) CHARACTER SET
>NONE COLLATE NONE
>);
>
>The foreign-key constraint:
>
>ALTER TABLE INKIND ADD CONSTRAINT FK_INKIND_CONTRIBUTIONS
> FOREIGN KEY (CONTRIBUTIONNR) REFERENCES CONTRIBUTIONS
> (CONTRIBUTIONNR)
> ON DELETE CASCADE
> ON UPDATE NO ACTION;
>
>The Insert query that is failing, taken from the debugger watch window:
>
>Insert into InKind ( ContributionNr, Description ) values( 56, '420 pens' )
>
>I stopped execution at the point where the above query would be the next
>item processed. I then looked at the "Contributors" table and verified that
>a record with primary key value of 56 does in fact exist.