Subject Options after Where statement
Author Alan.Davies@aldis-systems.co.uk
Hi - I'm using FB 2.1 on various systems, e.g. W2003 server, and am
looking to improve readability and reduce the possibility of errors
within stored procedures.
A very simple example would be:
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
statement surrounding the "where .." or by setting a variable with
the relevant condition?
Not possible to alter the way the parameters are passed, they come
from Delphi apps written by others.

--
Alan J Davies
Aldis