Subject RE: [firebird-support] Re: Conditional conundrum
Author Rick Debay
'U' is a one character value that may be contained in the column.
:param is a parameter in the stored procedure.

> Where
> (unit_use in ('U') and :param = 'U') or
> (unit_use not in ('U') and :param not ='U')

Is this legal for Firebird? In the stored procedure it would resolve to

Where
(unit_use in ('U') and 'X' = 'U') or
(unit_use not in ('U') and 'X' not ='U')

If the parameter passed to the stored procedure was 'X'. From
experience and previous discussions, the planner has problems with
statements like this (the most discussed conditional that gives the
planner a fit is NULL IS NULL).

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Ann W. Harrison
Sent: Thursday, October 20, 2005 3:04 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Re: Conditional conundrum

Rick Debay wrote:
> Select
> *
> From
> some_big_join
> Where
> (unit_use in ('U') and :param in ('U')) or
> (unit_use not in ('U') and :param not in ('U'))
>
> The portion of the query that tests a parameter against a value isn't
supported in Firebird.

Is 'U' shorthand for a long list of values? Is Param a field name? The
very simple

Where
(unit_use in ('U') and :param = 'U') or
(unit_use not in ('U') and :param not ='U')

suggests itself if not. Alternately, you could use EXECUTE STATEMENT to
build up your query.

Regards,


Ann



------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/67folB/TM
--------------------------------------------------------------------~->

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item on
the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links