Subject Re: [firebird-support] EXECUTE STATEMENT problem understanding
Author Mark Rotteveel
On Fri, 26 Jul 2013 13:14:08 +0100, Alan J Davies
<Alan.Davies@...> wrote:
> Ok, Mark & Markus, thanks again for both your help.
> I've tried this construct but get an error -206 column unknown pjs_no_in
> which is passed in as an input parameter
> declare variable table_to_use varchar(30);
> declare variable stmnt varchar(500);
> begin
> table_to_use='q_tool';
> begin
> EXECUTE STATEMENT 'update '|| table_to_use ||
> ' set tgp_no=:tgp_no,del_date=:del_date
> where (pjs_no=:pjs_no_in)';
>
> Column does not belong to referenced table.
> Dynamic SQL Error.
> SQL error code = -206.
> Column unknown.
> PJS_NO_IN.

You are not passing any parameters into the EXECUTE STATEMENT, so it does
not know about pjs_no_in, del_date or tgp_no. The query executed cannot
access parameters or variables declared in the stored procedure, you need
to pass them explicitly. See
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-psql-execstat.html#langrefupd25-psql-execstat-with-params

See also my first mail for an example on how you pass in parameters.

Mark