IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Rule be enforced by referential integrity constraints


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ntmartins

New User


Joined: 03 Mar 2008
Posts: 11
Location: Lisboa, Portugal

PostPosted: Thu Dec 04, 2008 5:47 pm
Reply with quote

The zoo has a business rule that a food cannot be deleted if that food is the only food eaten by any animal. Can this rule be enforced by referential integrity (foreign key) constraints? (In other words, can referential integrity keep us from deleting a food from LEGAL_FOOD if that food occurs in the only species-food row for a particular species?)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Dec 04, 2008 9:15 pm
Reply with quote

Hello,

Quote:
can referential integrity keep us from deleting a food from LEGAL_FOOD if that food occurs in the only species-food row for a particular species
I believe not. Referential integrity could prevent deletion if this food was eaten by some animal, but not if it is the only food eaten by an animal.

The deletion validation would go something like determining a list of animals who ate this food, then determining if this food was the only food eaten by each animal in the list. Not a feature/function of referential integrity.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Dec 04, 2008 9:22 pm
Reply with quote

I think it could be enforced by a trigger.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Need suggestion on how to force refer... DB2 7
No new posts Business Rule extraction CLIST & REXX 9
No new posts Need a golden rule to avoid SQLCODE -805 ABENDS & Debugging 8
No new posts Referencial Integrity to be enforced ... DB2 12
No new posts Referential read of an array element COBOL Programming 6
Search our Forums:

Back to Top