Bug #32438 cannot execute query ALTER TABLE from Stored Procedures
Submitted: 16 Nov 2007 14:45 Modified: 19 Nov 2007 9:39
Reporter: Aleksandr Zaika Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.0.45 OS:Windows (XP)
Assigned to: CPU Architecture:Any

[16 Nov 2007 14:45] Aleksandr Zaika
Description:
I try execute query ALTER TABLE in PROCEDURE and cannot ADD columns if name of columns sets as environment.

How to repeat:
example:
CREATE DEFINER=`root`@`localhost` PROCEDURE `add`(prefix_ VARCHAR(5))
BEGIN
  SELECT @col1 := CONCAT(@prefix_,'text');
  ALTER TABLE table1 ADD COLUMN col1 VARCHAR(50);#create column 'col1'
  ALTER TABLE table1 ADD COLUMN @col1 VARCHAR(50);#error 1064 
END $$
[19 Nov 2007 9:39] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Please read at http://dev.mysql.com/doc/refman/5.0/en/user-variables.html where usage of user variables is allowed.