Subject Re: BUG IN FIREBIRD
Author banzatto@ciagri.usp.br
Sorry by BUG and thanks, the solution this OK, but now i have another
problem, whell :

How do i make for check if a parameter is null ???
ex :

select DIVISAO1,DIVISAO2 from AREA where
(DIVISAO1 = :DIVISAO1) OR (DIVISAO1 IS NULL AND :DIVISAO1 IS NULL)





--- In ib-support@y..., "Ann W. Harrison" <aharrison@i...> wrote:
> banzatto@c... wrote:
>
> >CREATE TRIGGER AREA_BI0 FOR AREA
> >...
> > > > WHERE (A.DIVISAO1 = NEW.DIVISAO1)
> > > > AND (A.DIVISAO2 = NEW.DIVISAO2)
> > > > AND (A.DIVISAO3 = NEW.DIVISAO3)
> > > > AND (A.DIVISAO4 = NEW.DIVISAO4)))
> > > > THEN
> > > > EXCEPTION CHAVE_DUPLICADA;
> >
> >The fields DIVISAO1, DIVISAO2, DIVISAO3, DIVISAO4 cannot have to be
> >duplicate, but they can have null values , therefore the use of
> >trigger. Only that to trigger she does not function. Why ?
>
> If one of those fields has a null value in either table, then your
> boolean expression evaluates to false. To make this work, you'll
> need to add code to handle the null case.
>
> >CREATE TRIGGER AREA_BI0 FOR AREA
> >...
> > > > WHERE (A.DIVISAO1 = NEW.DIVISAO1
> OR A.DIVISAO1 IS NULL AND NEW.DIVISAO1 IS
> NULL)
> > > > AND (A.DIVISAO2 = NEW.DIVISAO2
> OR A.DIVISAO2 IS NULL AND NEW.DIVISAO2 IS
> NULL)
> > > > AND (A.DIVISAO3 = NEW.DIVISAO3
> OR A.DIVISAO3 IS NULL AND NEW.DIVISAO3 IS
> NULL)
> > > > AND (A.DIVISAO4 = NEW.DIVISAO4
> OR A.DIVISAO4 IS NULL AND NEW.DIVISAO4 IS
> NULL)))
> > > > THEN
> > > > EXCEPTION CHAVE_DUPLICADA;
>
>
> Regards,
>
> Ann
> www.ibphoenix.com
> We have answers.
>
>
> Please, next time, don't shout bug until you're more certain you've
got a bug.
> It upset me.