Hello,
I have a problem with a stored procedure (mysql server ver 5.0.18)
Quote
CREATE PROCEDURE `some_funnc`(IN startIndex INT, IN countNum INT, OUT var1 INT)
READS SQL DATA
BEGIN
declare vaar1 int;
SET @assd = CONCAT('SELECT `id_book` into ',var1,' FROM `suitcase_booking` LIMIT ',startIndex,',',countNum);
PREPARE zxc FROM @assd;
EXECUTE zxc;
END
When I run it, it returns error
Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
Why this is not working?
Generally I am using PLC with MES interface, and I want to read n-th row element from database and store it in PLC register. Everything works fine, except this OUT parameter. When I delete the
"... into ',var1,' ..." it doesn't return error, but it also doesnt return any data.
I have tried different versions and IN parameters for limit works fine, but when I assign INTO section of SELECT it fails.
If it is not possible in that way, how can I do it another way? (Stored procedure only, as the PLC module doesnt support functions).
Please help me with this matter