Prepare statement allows only global variables?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • getmeidea
    New Member
    • Feb 2007
    • 36

    Prepare statement allows only global variables?

    [CODE=mysql]SET @qry = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
    PREPARE stmt2 FROM @s;
    SET @first_param = 6;
    SET @sec_param = 8;
    EXECUTE stmt2 USING @first_param, @sec_param;
    [/CODE]

    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?
    Last edited by Atli; Oct 7 '08, 01:35 AM. Reason: Added [code] tags.
Working...