Subject Problem with foreign key
Author Grant Brown
HI all,

When I run the following stored procedure I keep getting a foreign key
violation.

HEAD_ID is the value that links as the FK to another table

Now I have checked that the value being passed as :HEAD does in fact
exist in the master table.

Can anyone tell me why this is causing such a violation ?

-------- stored procedure -------

tmpid = GEN_ID(GEN_PK_KEY_FEAT_ID, 1);
insert into BUS_KEY_FEAT(HEAD_ID, DETECT_ID, DATATYPE, K_ITEM_ID)
values (:HEAD, :tmpid, :DT, :ITEM_NO);

-------- foreign Key -------

ALTER TABLE BUS_KEY_FEAT ADD CONSTRAINT FK_BUS_KEY_FEAT_ID
FOREIGN KEY (HEAD_ID) REFERENCES BUSDETAILS
(DETECTID)
ON DELETE CASCADE
ON UPDATE NO ACTION;

--
Regards,
Grant Brown

Product Development Manager
Phone : 02 4229 1185
Mobile : 0412 926 995
Email : grant@...
Web : www.sitedoc.com.au

SiteDoc - Easy to Use - Powerful Results