Bug #8659 SET out parameter in stored procedure does not work
Submitted: 21 Feb 2005 19:25 Modified: 21 Feb 2005 23:01
Reporter: Steven Toth Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2 OS:Windows (Windows XP Pro)
Assigned to: CPU Architecture:Any

[21 Feb 2005 19:25] Steven Toth
Description:
Calling a stored procedure that values an out parameter via the SET command does not work.  No value is returned in the out parameter. 

How to repeat:
Create SP that has OUT parameter and values it using SET command...

DELIMITER $$

CREATE PROCEDURE `mysql`.`getCurrentDateTime`(OUT out_current_datetime DATETIME)
  SET out_current_datetime  = NOW()$$

DELIMITER ;

Calling SP return null in OUT parameter. 

Changed SP to do a SELECT NOW()$$

SP successfuly returns current date/time.

Changed SP to SET OUT parameter to NOW and then SELECT OUT parameter...

DELIMITER $$

CREATE PROCEDURE `mysql`.`getCurrentDateTime`(OUT out_current_datetime DATETIME)
BEGIN
  SET out_current_datetime  = NOW();
  SELECT out_current_datetime;
END$$

DELIMITER ;

SP returns null value in resultset.  

Conclusion is SET command is never assigning value into OUT parameter.
[21 Feb 2005 23:01] Aleksey Kishkin
Hi! I cannot reproduce this bug.  If you have ideas how to reproduce it please let us know..

mysql> select version();
+-------------+
| version()   |
+-------------+
| 5.0.2-alpha |
+-------------+
1 row in set (0.02 sec)

mysql> call mysql.getCurrentDateTime(@a);
+----------------------+
| out_current_datetime |
+----------------------+
| 2005-02-22 01:57:14  |
+----------------------+
1 row in set (0.02 sec)

Query OK, 0 rows affected (0.03 sec)

mysql> select @a;
+---------------------+
| @a                  |
+---------------------+
| 2005-02-22 01:57:14 |
+---------------------+
1 row in set (0.00 sec)
[22 Feb 2005 2:31] Steven Toth
My apologies.  It seems the problem is with the .NET Connector.