Subject Re: [firebird-support] part of statements optional
Author Walter Ogston
Gotta drag my mind back to discrete math, boolean algebra etc. Does

(condition and (a=b)) or (not condition and (c=b))

do what you want?

At 10:28 AM 4/22/2005, you wrote:
>I have spent some time looking around for ways to make part of select
>statements optional it has turned up solutions for some DB:s but not for
>firebird so I would like to check with you that it is truly not available.
>
>In the simplest form I am asking for a way to have different where clauses
>in select statements for instance.
>
>Something like this works:
>
>If (condition) then
> Select * from table where a=b
>Else
> Select * from table where c=b
>
>But it turns ugly which big select statements using lots of tables and out
>parameters.
>
>So something like the below would save a lot of typing and sources of errors.
>
>Select * from table
> If (condition) then
> where a=b
> else
> where b=b
>
>To me it seems reasonably easy to implement in its simplest form where it
>is just a syntactic sugar for the first version.
>
>Instead of me having to type the long version I think the compiler should
>create all the messy copy/pasting.
>
>I have found out about the case statement but it doesn't seem to be what I
>am looking for and I have also seen that it is doable with dynamic SQL but
>that has its drawbacks both in terms of cleanliness and speed.
>
>Is there no such feature or have I just missed something obvious?
>
>Tim
>
>
>
>----------
>Yahoo! Groups Links
> * To visit your group on the web, go to:
> *
> <http://groups.yahoo.com/group/firebird-support/>http://groups.yahoo.com/group/firebird-support/
>
> *
> * To unsubscribe from this group, send an email to:
> *
> <mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>firebird-support-unsubscribe@yahoogroups.com
>
> *
> * Your use of Yahoo! Groups is subject to the
> <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.

/*
C. Walter Ogston
ogstoncw@...
*/