Subject Re: [firebird-support] Options after Where statement
Author Ivan Prenosil
> 3 parameters passed to sp - name_or_code, locname and loccode
> begin
> if (:name_or_code=0) then /* code */
> begin
> for select supp_code,supp_name
> from supplier
> /* next line is the only difference */
> where supp_code=:loccode
> into :code,:name
> do
> suspend;
> end
> else if (:name_or_code=1) then /* name */
> begin
> for select supp_code,supp_name
> from supplier
> /* next line is the only difference */
> where supp_name=:locname
> into :code,:name
> do
> suspend;
> end
> end
>
> Is it possible to combine these into one statement with e.g. a case

if (name_or_code=0) then
locname = null;
else
loccode = null;

for select supp_code,supp_name
from supplier
where supp_code=:loccode or supp_name=:locname
into :code,:name
do
suspend;

Ivan
http://www.volny.cz/iprenosil/interbase/