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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With