Subject | Problem with Execute statement |
---|---|
Author | Paul Mercea |
Post date | 2006-04-08T15:51:27Z |
Hi
I want to create generic procedure to execute sql statements passed as
variable.
I have made this test procedure to verify if is working:
CREATE PROCEDURE T2 (
T VARCHAR(20))
RETURNS (
IDN VARCHAR(30),
IDL INTEGER)
AS
DECLARE VARIABLE STRSQL VARCHAR(50);
begin
strsql='select loc_id, loc_name from '||T;
for execute statement :strsql into :idl, :idn do
begin
suspend;
end
end
I pass table name (SYS_LOCATION) and I get this error message:
"Variable type (position 0) in EXECUTE STATEMENT 'select loc_id, loc_name
from SY' INTO does not match returned column type.
Password required"
If I change strsql='select loc_id, loc_name from '||T||' '; I get message:
"Variable type (position 1) in EXECUTE ......"
Same message if I modify like this:
strsql='select loc_id, loc_name from ';
for execute statement :strsql ||T into :idl, :idn do
What I'm doing wrong????
TIA
PaulM
I want to create generic procedure to execute sql statements passed as
variable.
I have made this test procedure to verify if is working:
CREATE PROCEDURE T2 (
T VARCHAR(20))
RETURNS (
IDN VARCHAR(30),
IDL INTEGER)
AS
DECLARE VARIABLE STRSQL VARCHAR(50);
begin
strsql='select loc_id, loc_name from '||T;
for execute statement :strsql into :idl, :idn do
begin
suspend;
end
end
I pass table name (SYS_LOCATION) and I get this error message:
"Variable type (position 0) in EXECUTE STATEMENT 'select loc_id, loc_name
from SY' INTO does not match returned column type.
Password required"
If I change strsql='select loc_id, loc_name from '||T||' '; I get message:
"Variable type (position 1) in EXECUTE ......"
Same message if I modify like this:
strsql='select loc_id, loc_name from ';
for execute statement :strsql ||T into :idl, :idn do
What I'm doing wrong????
TIA
PaulM