Problem creating a stored procedure

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
aleigh2400
Posts: 1
Joined: Sat 18 Jun 2011 05:40

Problem creating a stored procedure

Post by aleigh2400 » Sat 18 Jun 2011 05:54

Hi,

I'm attempting to create a stored procedure using TMyScript and I get a 24000 error on the "FETCH reconciliationsCur INTO a;" line when it gets to this code...

OPEN reconciliationsCur;
my_loop:LOOP
FETCH reconciliationsCur INTO a;
IF done THEN
LEAVE my_loop;
END IF;

The script runs no problem when I execute it in phpMyAdmin or SQLyog. Why is it throwing an error here when this script runs fine elsewhere?

I'm using MyDAC version 6.10.0.8 and MySQL server version 5.1.56.

Thanks in advance for your help.

Regards,

Andrew

AndreyZ

Post by AndreyZ » Mon 20 Jun 2011 08:53

Hello,

The point is that the TMyScript component interprets the ":LOOP" string as a parameter. To solve the problem, you should insert the space symbol between colon and the LOOP statement in the following way:

Code: Select all

OPEN reconciliationsCur; 
my_loop: LOOP 
FETCH reconciliationsCur INTO a; 
IF done THEN 
LEAVE my_loop; 
END IF;

Post Reply