I have a table which stores M:M relationships. I can't put foreign keys to the parents of this table because the relationships being stored go to several tables. This was done so that only two fields have to be searched in order for all relationships to be found for an item. For an oem number there might be 50 to 100 relationships and 40 different tables having to do with materials, locations, revisions, specifications, customer, etc. that might be referenced.
Is there some way I can make a mock foreign key restraint on the parents so the parent would search the M:M table for a matching value in key1 if the relate-key is 22, 23, 25 or 100 before it allows the row to be deleted?