I have a stored procedure, which counts results from a query, with 2 in parameters. One needs to be an exact match, the other can match as long as it starts with the specified parameter.
CREATE OR REPLACE PROCEDURE CandidateCount(IN param_pack VARCHAR(64), IN param_value VARCHAR(64), OUT result INTEGER)
BEGIN
SELECT COUNT(*) INTO result " + conditions + " LIMIT 1;
END
conditions:
String conditions = " FROM Product WHERE ";
conditions += "PackageName = RTRIM(param_pack)"; //works fine
conditions += " AND (";
conditions += "ProductNumber = RTRIM(param_value)"; //works fine
conditions += " OR ";
conditions += "ProductNumber LIKE RTRIM(param_value) + '%'"; //doesnt work
conditions += " OR ";
conditions += "ProductName LIKE RTRIM(param_value) + '%'"; //doesnt work
conditions += ")";
I tried to do the stuff people said in this question.
I'm not getting any warnings about the syntax so I'm not sure what I'm doing wrong. The database I'm connecting to is MariaDB 10.3, and I'm doing so through jdbc.