set @clientsql=concat('select downtype  into  ',var_downtype,'  from kkr_client_download_count_t_',varyearmonth,'  where downtype=1 group by downtype');       select @clientsql;        prepare stmt from @clientsql;
        EXECUTE stmt;
        deallocate prepare stmt;
   请教高人,为何打印为空:   +------------+
| @clientsql |
+------------+
| NULL       |
+------------+   谢谢!

解决方案 »

  1.   

    select downtype into var_downtype from kkr_client_download_count_t_varyearmonth where downtype=1 group by downtype红字标明的 楼主有注意吗?
      

  2.   

       var_downtype 为声明的变量类型.
      

  3.   

    var_downtype,varyearmonth 变量的内容是否赋值,估计是还没有,这样值就是NULL了。
      

  4.   

    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖
      

  5.   

       var_downtype,varyearmonth 变量的内容是能得到值,打印能取得到,现在不明白为何语句为空!
      

  6.   

    改成这个
    select @clientsql,var_downtype,varyearmonth; 证明一下它们不为NULL
      

  7.   

    你call 存储过程的时候 需要把var_downtype 这个的变量改成:
    @开头的..
    如:
    mysql> call asdaa('@sq')
        -> ;
    Query OK, 0 rows affected (0.00 sec)mysql> select @sq
        -> ;
    +------+
    | @sq  |
    +------+
    | A    |
    +------+
    1 row in set (0.00 sec)