Subject | Re: [firebird-support] If and For Select |
---|---|
Author | Milan Babuskov |
Post date | 2008-02-12T16:48:15Z |
paultugwell wrote:
declare variable stmt varchar(100);
...
if (x = 0) then
stmt = 'select a from b';
else
stmt = 'select a from b where z = '||x;
for execute statement :stmt into :c do
begin
...
end
--
Milan Babuskov
http://www.guacosoft.com
> if (X=0) thenYes.
> for select a from b into :c
> else
> for select a from b where z = :x into c
>
> Is this possible?
> If so, how would I code the for select statements?You can use EXECUTE STATEMENT for example:
declare variable stmt varchar(100);
...
if (x = 0) then
stmt = 'select a from b';
else
stmt = 'select a from b where z = '||x;
for execute statement :stmt into :c do
begin
...
end
--
Milan Babuskov
http://www.guacosoft.com