Subject | Re: [ib-support] logical operations |
---|---|
Author | Jörg Schiemann |
Post date | 2001-03-21T16:31:41Z |
> Jörg Schiemann wrote:because
> >
> > > > 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,
> it looks to me as if you have answered your own question.Maybe an example will clearify what I want.
>
> In Stored Procedure language
>
> if ( (expression1) AND (expression2) ) then
> ...
>
> is equivalent to
>
> if (expression1 && expression2)
> ...
DECLARE VARIABLE RESULT INTEGER;
BEGIN
RESULT = 1 OR 4;
END
RESULT should be 5
Regards,
Jörg