browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need MySQL Database help?

Get answers from our community of MySQL Database experts on BYTES! It's free.

Prepare statement allows only global variables?

Member
 
Join Date: Feb 2007
Posts: 36
#1: Oct 6 '08
Expand|Select|Wrap|Line Numbers
  1. SET @qry = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
  2. PREPARE stmt2 FROM @s;
  3. SET @first_param = 6;
  4. SET @sec_param = 8;
  5. EXECUTE stmt2 USING @first_param, @sec_param;
  6.  
These are few lines in my stored procedure. Here if I change the identifiers @qry, @first_param, @sec_param to qry, first_param, sec_param respectively
mysql doesn't allow to compile the stored procedure.

Why only global variables are allowed here?



Reply