Skip to Content
Former Member
Aug 29, 2008 at 12:59 PM

Validation of a single data record on the basis of multiple data records



Is it possible to validate the dependence between data records? For instance I got a field which is a part of the primary key (lets call it pk_alternative_ID) and the user is able to set the value of this field. But not every value should be allowed.

The table could look like this:


pk_ID | pk_alternative_ID | some_value


00001 | 00000000000001 | abc

00001 | 00000000000002 | abc

00001 | 00000000000004 | abc

In this example the rule for pk_alternative_ID shall be: pk_alternative is unique and it should always be incremented by 1.

So the last data record is not valid, because the pk_alternative_ID should be "00000000000003". How could I validate this?