pro-select-like

 1 DELIMITER |
 2 drop procedure if exists pro_query;
 3 CREATE  PROCEDURE pro_query 
 4 ( 
 5     cname VARCHAR(50)
 6 )  
 7 BEGIN  
 8   
 9 #declare @sql varchar(1000)
10 
11 SELECT * ,cname FROM test WHERE (cname ="" or name like CONCAT('%',cname,'%') );
12 
13 END;
14 |
15 DELIMITER ;

 

posted @ 2017-06-13 16:49  苍洱  阅读(160)  评论(0编辑  收藏  举报