Subject | Re: [firebird-support] statement and composite variable names |
---|---|
Author | Helen Borrie |
Post date | 2012-05-23T10:45:29Z |
At 09:38 PM 23/05/2012, Helen Borrie wrote:
And we overlooked the apostrophes for the strings, too.
...
declare variable fname varchar(31);
...
i = 1;
while (i< 7) do
begin
fname = case
when i = 1 then f1
when i = 2 then f2
-- etcetera
end
'F' || cast (i as char);
idexists = 0;
stmtxt = 'select 1 from rdb$database where exists(SELECT * FROM
RDB$RELATION_FIELDS
WHERE RDB$RELATION_NAME = 'T_DT'
and RDB$FIELD_NAME = ''' || fname || ''';
execute statement stmtxt into :idexists;
if(idexists = 0) then
begin
--.
break;
end
i = i + 1;
end
./hb
>...Seeing Nando's comment made me realise I had misunderstood your description - despite all the UPPER CASE LETTERS - sorry!
>declare variable fname varchar(31);
>...
>i = 1;
>while (i< 7) do
>begin
>fname = 'F' || cast (i as char);
>idexists = 0;
>stmtxt = 'select 1 from rdb$database where exists(SELECT * FROM
>RDB$RELATION_FIELDS
>WHERE RDB$RELATION_NAME = T_DT
>and RDB$FIELD_NAME = ' || fname;
>execute statement stmtxt into :idexists;
>if(idexists = 0) then
>begin
>--.
>break;
>end
>i = i + 1;
>end
And we overlooked the apostrophes for the strings, too.
...
declare variable fname varchar(31);
...
i = 1;
while (i< 7) do
begin
fname = case
when i = 1 then f1
when i = 2 then f2
-- etcetera
end
'F' || cast (i as char);
idexists = 0;
stmtxt = 'select 1 from rdb$database where exists(SELECT * FROM
RDB$RELATION_FIELDS
WHERE RDB$RELATION_NAME = 'T_DT'
and RDB$FIELD_NAME = ''' || fname || ''';
execute statement stmtxt into :idexists;
if(idexists = 0) then
begin
--.
break;
end
i = i + 1;
end
./hb