如prepare stmt from ' select 55-9 ';
execute stmt;
drop prepare stmt;得到值为46我想把这个值付给一个变量aa
请教语句写法

解决方案 »

  1.   


    prepare stmt from ' SET @x = 55-9 ';
    execute stmt;select @x;
    drop prepare stmt;
      

  2.   

    klan 你这种写法报错:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '66666()' at line 1
    66666() 是我测试定义的存储过程名字,内容如上klan
      

  3.   

    取个别名呢? "select 55-9 a" 能否从结果集中取得 a 的值?
      

  4.   

    也不行了诶
    我现在是绕了很大弯才实现的
    做了个存储过程 存如表,在从表中取出 out 才得到这个值