Tough data validation problem

From: Chris Fischer <null_at_nowhere.com>
Date: Thu, 15 Mar 2001 14:44:59 -0500
Message-ID: <pt62bt8ogs8epqjmtn5hsaodsn4bhjj9kt_at_4ax.com>


[Quoted] [Quoted] Hello, I've got a unique data validation requirement.

[Quoted] I've got two tables MASTER and DETAIL.

One of the columns in DETAIL is PRIMARY_FLAG.

In my form, which is a typical master detail form, the user can enter a MASTER with one or more DETAILs. They must enter a value for the PRIMARY_FLAG. Allowed values are 'Y' and 'N'. One and only one detail must have a 'Y' the rest must have 'N'.

How/where can I enforce this? I can't write a DB trigger because AFTER INSERT will fire for each one. I can't do it in PRE-INSERT on the DETAIL block because a later one may have the 'Y' set. I can't do it in PRE/POST insert on the MASTER block, because the MASTER might have been inserted previously and the operator is only coming back to create DETAILS.

Any ideas??

TIA. chris PERIOD fischer AT itron d.o.t com Received on Thu Mar 15 2001 - 20:44:59 CET

Original text of this message