Page 1 of 1

Using 'EXECUTE STATEMENT' with IBDAC and Firebird2.1

Posted: Wed 28 Jul 2010 22:15
by dennis
I'm trying to 'execute' the following stored procedure:

CREATE PROCEDURE LOCATE (
TABLENAME Char(32),
COLUMNNAME Char(32),
FIELDVALUE Char(60) )
RETURNS (
"FOUND" Smallint )
AS
DECLARE VARIABLE RESULT CHAR(60);
BEGIN

RESULT = NULL;
EXECUTE STATEMENT 'SELECT DISTINCT ' || COLUMNNAME || ' FROM ' || TABLENAME || ' WHERE ' ||
COLUMNNAME || ' = ' ||''''||FIELDVALUE||'''' INTO RESULT;
IF (RESULT IS NOT NULL) THEN
FOUND=-1;
ELSE
FOUND=0;
SUSPEND;
END^

by using a IBCQuery component with the following SQL statement:

Select * from LOCATE(:TABLENAME, :COLUMNNAME,:FIELDVALUE);

When executed, I get the following error:

"Invalid argument in EXECUTE STATEMENT - cannot convert to string
At procedure 'LOCATE' line:13, col:1."

Does IBC components support the new 'EXECUTE STATEMENT' syntax?

Thanks,

Dennis

Posted: Thu 29 Jul 2010 07:45
by piotrt
Your problem has nothing to do with IBC. You are not running 'EXECUTE STATEMENT' in TIBCQuery but only simple select, so problem is in your stored procedure (IBC knows nothing about what's inside your procedure). Insure that all parameters of IBCQuery have assigned values. And test this query in your db tool (I recommend FlameRobin).

Posted: Thu 29 Jul 2010 13:24
by Dimon
piotrt wrote:Your problem has nothing to do with IBC. You are not running 'EXECUTE STATEMENT' in TIBCQuery but only simple select, so problem is in your stored procedure (IBC knows nothing about what's inside your procedure). Insure that all parameters of IBCQuery have assigned values. And test this query in your db tool (I recommend FlameRobin).
It's correct. This probelm is connected with the work of your Firebird server and not with IBDAC.