Subject Re: [ib-support] logical operations
Author Jörg Schiemann
> Jörg Schiemann wrote:
> >
> > > > Hi,
> > > >
> > > > how do I perform logical operations within SP?
> > > >
> > >
> > > You evaluate expressions by enclosing them in parentheses:
> > >
> > > if (AVAL='XYZ') then
> > >
> > > Or do you mean something else by logical operations?
> >
> > I mean the logical operations AND, OR, NOT.
> > In C you use && , || , !
> >
> > i.e.
> > 1 AND 0 = 0
> > 1 AND 1 = 1
> > 1 OR 0 = 1
> > 1 OR 1 = 1
> >
>
> I think you will have to be even clearer about what you want to achieve,
because
> it looks to me as if you have answered your own question.
>
> In Stored Procedure language
>
> if ( (expression1) AND (expression2) ) then
> ...
>
> is equivalent to
>
> if (expression1 && expression2)
> ...

Maybe an example will clearify what I want.

DECLARE VARIABLE RESULT INTEGER;
BEGIN
RESULT = 1 OR 4;
END

RESULT should be 5

Regards,
Jörg