> I think you are missing the point. Where is 'OLD' or 'old' defined?
> Before you try to imbed it in a trigger, try the basic query. That seems
> to be what its complaining about.
OLD is a virtual table which is only present in a trigger - it's like a
table with the same layout as the table the trigger is attached to,
which contains the row (or rows) that were deleted (for a DELETE query)
or updated (for an UPDATE query - pre-update.) Just the same as (IIRC)
NEW is a virtual table that contains the row (or rows) that were
inserted (for an INSERT query) or updated (for an UPDATE query -
The query in question will fail anywhere outside the trigger because NEW
and OLD are only in scope in triggers.
OLD is akin to the "deleted" virtual table in MS SQL Server triggers,
just like NEW is akin to the "inserted" virtual table in MSSQL.
Going back to the OP's problem - the original issue I believe was he was
using "old" instead of "OLD" (case-sensitive) - now that's sorted, MySQL
is complaining about a syntax error toward the end of the function