TMyStoredProc & OUT Error

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ACS2000
Posts: 31
Joined: Thu 18 May 2006 11:10

TMyStoredProc & OUT Error

Post by ACS2000 » Thu 18 May 2006 11:16

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 18 May 2006 12:27

MySQL Server data transferring protocol does not support output parameters. Please refer to this topic.

ACS2000
Posts: 31
Joined: Thu 18 May 2006 11:10

Post by ACS2000 » Thu 18 May 2006 12:53

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 18 May 2006 13:58

> 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.

ACS2000
Posts: 31
Joined: Thu 18 May 2006 11:10

Post by ACS2000 » Thu 18 May 2006 14:17

Thanks

Post Reply