Subject | RE: [firebird-support] statement and composite variable names |
---|---|
Author | Svein Erling Tysvær |
Post date | 2012-05-23T07:50:25Z |
Olaf wrote:
Set
> Hello,Thomas answered:
>
> In a stored procedure there are 6 Input Parameters F1 to F6. This
> varchar variables contains table-field-names and I verify this.
>
> Now I thought I can use a statement like this:
>
> i = 0;
>
> 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 = :' || 'F' || :i;
>
> execute statement :stmtxt into :idexists;
>
> if(idexists = 0) then
>
> begin
>
> --.
>
> break;
>
> end
>
> i = i + 1;
>
> end
>
> How can I use the content of F1 to F6 in this statement (not the name
> of variable rather the content). Actually the statement uses .._name =
> :F1
>
> Thanks in advance.
>
> Best regards.
>
> Olaf
>Olaf,I'd say his question is quite clear, he has input variables F1 through F6 and wants to use some kind of indirection to access them:
> Is there no option to use internal variables (composite) in a statement?
>IMHO, it isn't entirely clear what you want to achieve.
> WHERE RDB$RELATION_NAME = T_DT and RDB$FIELD_NAME = :' || 'F' || :i;Rather than the more common
> WHERE RDB$RELATION_NAME = T_DT and RDB$FIELD_NAME = ' || :F1; (or F2-6)Unfortunately, I've no clue about the answer.
Set