Subject Re: [firebird-support] Custom RI was Re: Possible bug with CHECK constraint
Author German Pablo Gentile
Martijn Tonies wrote:

>You can - by raising an exception. Obviously, you need to catch this
>exception in your client code as you would with a FK exception.
>
>You can create custom exceptions via
>CREATE EXCEPTION <name> '<message>'
>
>
>

I find a doc writed by Bill Todd with stored procedures and trigger details.

http://www.ibphoenix.com/a418.htm?a=ibphoenix&s=1096838625:415171&page=ibp_intro_sp_trig

Fine, i write my first trigger, but it dont compile, and iu can see why not.

CREATE TRIGGER conductores_BDO FOR CONDUCTORES ACTIVE BEFORE DELETE
POSITION 0
AS
begin
/* Trigger text */
if (OLD_IDCONDUCTOR ANY
(SELECT IDCONDUCTOR FROM DESPACHADO WHERE IDCONDUCTOR =
OLD_IDCONDUCTOR)
) then
begin
exception EX_DESPACHADO_VEHICULO;
suspend;
end;
end

And i get :

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 6, char 23.
ANY.

All ids are valid, and ANY seems to be valid too.I dont understand that
i missed.

TIA.

German.