Subject | Custom RI was Re: Possible bug with CHECK constraint |
---|---|
Author | promolinux |
Post date | 2004-10-04T01:57:36Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
having IDBOMBAS value in DESPACHADO it delete,but if i select one
having a value in despachado it raises exception.
German.
wrote:
> At 09:20 PM 3/10/2004 -0300, you wrote:BOMBAS, your
>
>
> It is also wrong. Assuming this is a BeforeDelete trigger on
> trigger will all deletions to any records from this table if *any*record
> in despachado has a matching record in bombas..Is strange, but dont do that. If i select a record in BOMBAS not
>
having IDBOMBAS value in DESPACHADO it delete,but if i select one
having a value in despachado it raises exception.
> What you *really* want to do is test whether there are any recordsin
> despachado that are dependent on the CURRENT record:I will try that.
>
> create trigger bd_bombas for bombas
> active before delete
> as
> begin
> if (exists (select 1 from despachado
> where idbomba = OLD.idbomba)) then
> exception ex_despachado_bomba;
> end
>
> Hint: you will also need Before Insert and Before Update triggerson
> DESPACHADO to restrict despachado.idbomba to values that exist inBOMBAS.
>Uf, a lot of stuff... I really like foreign keys.
German.