Subject Re: [firebird-support] Execute statement
Author Martijn Tonies
Hi,

> >> After reading release notes, I try to use this nice feature.
> >> A line from my test sp:
> >> EXECUTE STATEMENT 'SELECT NUMF1 FROM MY_TABLE WHERE ID=1 '
> >> INTO :MY_NUMF;
> >>
> >> But it doesn't work. MY_NUMF don't get the value.
> >> Is it a correct operation?
>
> I haven't yet used EXECUTE STATEMENT myself, but shouldn't you
> place the second apostrophe at the end of the statement to be
> executed, i.e.
>
> execute statement
> 'select numf1 from my_table where id=1 into :my_numf';

No, this isn't right. I've taken the below statement from a procedure that I
used, I had to use it like this, because "SUBSTRING" doesn't accept an
expressesion/variable, but only a constant:

execute statement 'select substring(email from 1 for ' || i || ')
from gebruiker where gebruikerid = ' || gebruikerid
into :prefix;

This worked fine for me - so I think the error is somewhere else.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com