Subject RE: [Firebird-Java] Int field restriction
Author Steffen Heil

> > I need make a restriction, at database level, where I can
> permit only the number 0 (zero) repeat. Numbers greater than
> 0 can't repeat.
> Would the NULL value fit your purposes? If you define the
> unique constraint, the rows with NULLs don't count, only the
> rows with values.
> Note that you can create another computed column which would
> have value of 0 if the original column is NULL. Also you can
> create index on computed column, so searches would be also fast.
> However it won't work if you must have NULL and 0s...

Just an untested idea...
How about creating a computed column that is equal to the original column
except that it is NULL if the original is 0.
Contraining that to be UNIQUE.....


[Non-text portions of this message have been removed]