MySQL Forums
Forum List  »  Stored Procedures

LIKE condition doesn't return result
Posted by: Mfon Williams
Date: March 16, 2013 07:02AM

/* Here is my procedure */

DROP PROCEDURE IF EXISTS `musicmerchant`.`getProductByName`;
DELIMITER $$
CREATE PROCEDURE `musicmerchant`.`getProductByName`(IN p_prod_name VARCHAR(50),
OUT product_id INT(11),
OUT product_name VARCHAR(50),
OUT product_info VARCHAR(255),
OUT rls_dt DATE,
OUT product_price DOUBLE,
OUT product_type_id INT(11),
OUT label VARCHAR(100),
OUT producers VARCHAR(255),
OUT recording_time VARCHAR(30),
OUT product_image BLOB,
OUT date_created DATE,
OUT date_modified DATE
)
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
DECLARE p_condition VARCHAR(100);
SET p_condition = CONCAT ('%' + p_prod_name + '%');
SELECT * FROM product WHERE product_name LIKE p_condition;
END$$

DELIMITER ;

/* This is the call to it that returns empty */

CALL getProductByName(
'e',
@product_id,
@product_name,
@product_info,
@rls_dt,
@product_price,
@product_type_id,
@label,
@producers,
@recording_time,
@product_image,
@date_created,
@date_modified
)

Options: ReplyQuote


Subject
Views
Written By
Posted
LIKE condition doesn't return result
2204
March 16, 2013 07:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.