Bug #28879 | Problem with dynamic queries and variables | ||
---|---|---|---|
Submitted: | 4 Jun 2007 16:19 | Modified: | 4 Jul 2007 18:34 |
Reporter: | Ivan Ramirez | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server: Stored Routines | Severity: | S3 (Non-critical) |
Version: | 5.0.33 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | dynamic queries, execute, prepare, variables |
[4 Jun 2007 16:19]
Ivan Ramirez
[4 Jun 2007 18:30]
Sveta Smirnova
Thank you for the report. Please be sure you read and understood correctly how you should write a program that use the CALL SQL statement to execute stored procedures that produce result sets. Please note PHP uses C API. So all rules for C programs can be applied to PHP program as well. If you still think problem is MySQL bug, please provide output of SHOW CREATE PROCEDURE user_info and try to create simple test case which doesn't use any framework.
[4 Jul 2007 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[8 Jan 2008 5:08]
minh duong
Hi. i have the same problem. Mysql report an error: Error Code : 1327 Undeclared variable: myvariable
[21 May 2008 20:05]
Seth Goings
I am having this basic issue as well. Here's some simple code: DROP PROCEDURE IF EXISTS `sum`| CREATE PROCEDURE `sum` ( IN `inCol` VARCHAR(50), OUT `outCol` VARCHAR(10) ) BEGIN DECLARE temp int default 0; set @queryText = concat("SELECT SUM(",inCol,") INTO outCol FROM test"); prepare query1 from @queryText; execute query1; set outCol=temp; END | You can mess around with this code, but no matter what, outCol is never set correctly. You can also see my forum posting here: http://forums.mysql.com/read.php?98,210627,210627#msg-210627