Subject Re: [firebird-support] EXECUTE STATEMENT problem understanding
Author Alan J Davies
Thanks Mark, it appears that what I want to do is not possible. i.e.
have the table name as a replaceable parameter. Using your example I
would still have 3 separate statements (as now) but in a different
format in the SP.
What I really would like to be able to do is (paraphrase):
declare table_to_use varchar(20);
if my_input_parameter='T' then table_to_use='q_tool'
else if my_input_parameter='G' then table_to_use='q_gauge'
else if my_input_parameter='P' then table_to_use='q_ppap'
end;
and then this code only once in the SP.

s = 'update :table_to_use set tgp_no = :tgp_no, del_date = :del_date
where pjs_no = :pjs_no'
EXECUTE STATEMENT (s) (tgp_no := tgp_no, del_date := del_date, pjs_no
:= pjs_no);

Regards
Alan

Alan J Davies
Aldis


On 26/07/2013 10:07, Mark Rotteveel wrote:
> What you need to do is roughly:
>
> s = 'update q_tool set tgp_no = :tgp_no, del_date = :del_date where pjs_no
> = :pjs_no'
> EXECUTE STATEMENT (s) (tgp_no := tgp_no, del_date := del_date, pjs_no :=
> pjs_no);
>
> Mark
>
>