On Thu, 2002-11-28 at 21:55, Adrian Klaver wrote:
> I have created the following function:
...
> IF new.tag_number=old.tag_number THEN
> RAISE EXCEPTION ''Number is already present '';
...
> The trigger seems to work to well. If I update values other than the
> tag_number I get the 'Number is already present' message. I am somewhat
> confused as their is no new.tag_number value being passed to the function.
> Can anyone set me straight?
NEW contains the whole changed record; OLD contains the record before
the change. If you "update values other than the tag_number", the
tag_number is not changed, therefore the condition is true.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The earth is the LORD'S, and the fullness thereof; the
world, and they that dwell therein." Psalms 24:1