I am new to this database and I am stuck on a problem. I have a query which returns more than one row as output. I want to check whether the query returns a value or not based on a condition. I am using MySQL and a stored procedure.
CREATE PROCEDURE getSearchFilter(IN searchname varchar(220),categoryid int, categoryheading varchar(220),catdiscription varchar(220))
DETERMINISTIC
BEGIN
if SELECT IF( EXISTS(SELECT distinct categorie_heading FROM product_meta_data WHERE categorie_heading='material'), 1, 0) then
//code
else
//code
end if;
END
SELECT distinct categorie_heading FROM product_meta_data WHERE categorie_heading='material';
It returns multiple rows, but I want to check whether 'material' is present in the table or not.