Subject Re: [firebird-support] Re: Some explanations Needed
Author Helen Borrie
At 06:27 AM 28/08/2005 +0000, you wrote:
>Please see below answer...
>AFAIK you can have as many UINQUEs on a table as you want. But anyway:
>can make sure by using a before InsertUpdate-trigger checking for an
>exists(select FIELD from table where FIELD=VALUE) on your FIELD and
>....My question..
>How to define UNIQUE on a column>?

You need a UNIQUE constraint on a column or group of columns to make it
available as a REFERENCES target for a foreign key constraint. A unique
index is created for the UNIQUE constraint, but an index that is defined
with the UNIQUE attribute is *not* a UNIQUE constraint.


>Also..what is VALUE above, a variable declared in trigger..?

In a trigger, VALUE would be the "NEW." context variable for the column in
the trigger's owning table that is being checked. There is a "NEW."
context variable available for every column in a table in an INSERT or
UPDATE trigger. There is also a similar set of "OLD." variables available
to UPDATE and DELETE triggers.

IF (exists(select FIELD from table where FIELD=NEW.ThisColumn)) then