professor.rafael Posted February 19, 2012 at 01:19 AM Report Share #440300 Posted February 19, 2012 at 01:19 AM Caros mestres do MySQL estou com o seguinte problema na SP no MySQL, conforme abaixo: -- -------------------------------------------------------------------------------- -- Routine DDL -- Note: comments before and after the routine body will not be stored by the server -- -------------------------------------------------------------------------------- DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `exibir_clientes`( IN _filtro varchar(100) ) BEGIN IF (_filtro IS NULL) THEN select * from clientes; ELSE select * from clientes WHERE cli_nome LIKE `%` + _filtro + `%` - esta linha esta com erro OR cli_end LIKE `%` + _filtro + `%` OR cli_email LIKE `%` + _filtro + `%` OR cli_tel LIKE `%` + _filtro + `%` ENDIF; END Fico no aguardo de uma resposta, desde já atenciosamente. 😞 Link to comment Share on other sites More sharing options...
KTachyon Posted February 19, 2012 at 08:19 AM Report Share #440308 Posted February 19, 2012 at 08:19 AM Claro... o MySQL não vai concatenar o filtro. Tens que ser tu a criar o filtro antes de o adicionares à query, dentro da stored procedure. Para além disso, o '+' não é um operador de concatenação de strings em MySQL. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now