We have a SAS PROC SQL table like below, with one column
Table : dreams
The requirement is to enforce a integrity constraint on the table, so that the value of any new row inserted can only be max(var1) + 1.
i.e. For the above shown table, the table has to accept only insert statement only if Var1 = 6. Subsequent insert statement has to accept only Var1 = 7.
create table dreams (var1 num);
insert into dreams
set var1 = 1
set var1 = 2
set var1 = 3
set var1 = 4
set var1 = 5
Looks like this is not possible directly with constraints :S
Constraint ensures that a specific set or range of values are the only values in a column. It can also check the validity of a value in one column based
on a value in another column within the same row.