If you are using Fb 2.5, you can use this alternative syntax:
...
declare variable fname varchar(31);
...
i = 1;
stmtxt = 'select 1 from rdb$database where exists(SELECT * FROM
RDB$RELATION_FIELDS
WHERE RDB$RELATION_NAME = 'T_DT'
and RDB$FIELD_NAME = ''' || :fvalue || ''';

while (i< 7) do
begin
fname = case 
  when i = 1 then f1
  when i = 2 then f2
   --  etcetera
  end

/* SHOULD NOT BE HERE '*/ F' || cast (i as char);

idexists = 0;
execute statement (stmtxt) (fvalue := fname)
into :idexists;
if(idexists = 0) then
begin
--.
break;
end
i = i + 1;
end

./hb

Reply via email to