stored procedure using like (MySQL)
How can I use the LIKE statement in stored procedures (MySQL) ?
I tried both but I still get errors:
..WHERE Des_Articolo LIKE '%nome_art%';
..WHERE Des_Articolo LIKE'%',nome_art,'%';
nome_art is declared as
CREATE PROCEDURE ric_art (IN nome_开发者_高级运维art VARCHAR(100) , OUT msg VARCHAR(100))
Many thanks Roberto
Use CONCAT
to concatenate strings:
WHERE Des_Articolo LIKE CONCAT('%', nome_art, '%');
Note: This type of query is slow. If performance is an issue, you may want to consider an alternative approach such as full-text searching.
you can use:
..Where Des_Articolo like CONCAT('%',nome_art,'%');
Bun Leap_kh
精彩评论