首頁 >資料庫 >mysql教程 >创建mysql存储过程_MySQL

创建mysql存储过程_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-01 13:51:301070瀏覽

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