码迷,mamicode.com
首页 > 数据库 > 详细

mysql动态拼接sql语句

时间:2015-03-10 11:57:56      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:

begin

/**procedure body**/
if(m_parameter=‘‘) then
set @sqlStr=concat(‘select id,title,description,msg,logo,notice,views,grade,commenttimes from kmb01‘,‘ order by ‘,m_sort,‘ ‘,m_sortType,‘ limit ‘,m_index,‘,‘,m_length);
else
set @sqlStr=concat(‘select id,title,description,msg,logo,notice,views,grade,commenttimes from kmb01 where ‘,m_parameter,‘ order by ‘,m_sort,‘ ‘,m_sortType,‘ limit ‘,m_index,‘,‘,m_length);
end if;
PREPARE msql from @sqlStr;
EXECUTE msql;
end

mysql动态拼接sql语句

标签:

原文地址:http://www.cnblogs.com/engine/p/4325462.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!