Home > Database > Mysql Tutorial > mysql 动态执行存储过程语句_MySQL

mysql 动态执行存储过程语句_MySQL

WBOY
Release: 2016-06-01 13:19:30
Original
870 people have browsed it

bitsCN.com 下面写一个给大家做参考啊

create procedure sp_find(pfind varchar(500)
BEGIN
DECLAR msql varchar(2000);
SET @MyQuery=Concat('select * from 表 where ',pfind);
PREPARE msql from @MyQuery;
EXECUTE msql;
END

注意一点的就是MYSQL中有好多已经定义好的函数可以使用,比如上面的拼接函数Concat(),利用好这些函数会有很多帮助的。

bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template