Subject Re: Problem when returning values with EXECUTE STATEMENT
Author aalliana
Thanks Martijn.

Actually, Pname is a variable. I'm sorry I did not post the entire
code (I did not want to make the post too long). I post the code below.

Again, if I change the code to "select * from " instead of "execute
procedure, I have no problems, so I'm pretty sure I'm not having a
syntax error with the dynamic code, but I'm open for suggestions
obviously. I'm really asking this question because I don't want to
change all the executable procedures to selectable procedures just so I
can call them with EXECUTE STATEMENT.

create procedure aux_borrame_driver_proc(Par integer)
r1 integer,
r2 varchar(50)
declare variable Pname varchar(200);
-- get the procedure name from a table
select p.sql
from rshk_procedimientos p
where p.id_procedimiento = 1
into :Pname;

Sql = 'execute procedure ' || Pname || '(';
Sql = Sql || CAST(Par AS VARCHAR(20)) || ', ' || CAST(Par AS
VARCHAR(20)) || ')';

EXECUTE STATEMENT Sql into :r1, :r2;

r1 = r1; -- this line does nothing :)

[Non-text portions of this message have been removed]