Page 1 of 1

TMyStoredProc & OUT Error

Posted: Thu 18 May 2006 11:16
by ACS2000
I have just started playing with Stored Procedures.

I have written the following basic Procedure which works from the MySQL command line:

CREATE PROCEDURE `test`(OUT Result INT)
BEGIN

SELECT
COUNT(*) INTO Result
FROM
tms.custmain;

END

At the Command Line

call tms.test(@R);
SELECT @R

and works ok.

When I use the TMyStoredProc I get the error message

OUT or INOUT argument 1 for routine tms.test is not a variable

when I try to execute.

Help please!

Alan

Posted: Thu 18 May 2006 12:27
by Antaeus
MySQL Server data transferring protocol does not support output parameters. Please refer to this topic.

Posted: Thu 18 May 2006 12:53
by ACS2000
So I have to create a TMyQuery with the following SQL?

CALL tms.test(@R);
Select 0+@R AS Result

(I have used 0+ to make Result an Integer instead of a String, is there a better way?)

I was hoping that the TMyStoredProc would return its result in the Parameter.

Alan

Posted: Thu 18 May 2006 13:58
by Antaeus
> So I have to create a TMyQuery with the following SQL?
Yes, you are right.
> I have used 0+ to make Result an Integer instead of a String, is there a better way?
This syntax is completely suitable.

Posted: Thu 18 May 2006 14:17
by ACS2000
Thanks