Subject | Re: [firebird-support] statement and composite variable names |
---|---|
Author | Helen Borrie |
Post date | 2012-05-23T09:38:11Z |
At 07:58 PM 23/05/2012, Olaf Kluge wrote:
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
./hb
>I have 6 input variables in a stored procedure, named F1, F2, F3, F4, F5,...
>F6. In each variable it is entered a name of a column from a table. (F1 =
>column1, etc.)
>
>Now I need to check if the name in F1 to F6 is correct. I need the content
>of my input-variables, and I would the variable names composed dynamically
>('F' || i)
>
>while (i< 7) do
>begin
>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 = <<<THE CONTENT OF F1 to
>F6 ('F' || i)>>>
>execute statement :stmtxt into :idexists;
>if(idexists = 0) then
>begin
>--.
>break;
>end
>i = i + 1;
>end
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
./hb