首页  >  文章  >  数据库  >  创建mysql存储过程_MySQL

创建mysql存储过程_MySQL

WBOY
WBOY原创
2016-06-01 13:51:301026浏览

delimiter //

CREATE PROCEDURE get_trees(in conditions varchar(2048), in fields varchar(2048) , in sort char(255), in start int, in num int)  
BEGIN 
        /* 获得10条记录 */  
        SET @sql = CONCAT(’SELECT ‘, fields, ‘ FROM Persons WHERE ‘, conditions, ‘ ORDER BY ‘, sort, ‘ LIMIT ‘, start, ‘,’, num);  
        PREPARE sqlstmt FROM @sql;  
        EXECUTE sqlstmt;  
        DEALLOCATE PREPARE sqlstmt;  
END//

delimiter ;

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn