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

>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
>
>
>
My sintax was wrong. That work:

if (EXISTS
(SELECT IDBOMBA FROM DESPACHADO
WHERE DESPACHADO.IDBOMBA = bombas.idbomba)
)
then
begin
exception ex_despachado_bomba;
end

Theres any more eficient way to do that? the query takes a seconds
before result. I solve my insert troubles in despachado but have a not
liked delay deleting foreign records.

TIA

German.