MySQL Forums
Forum List  »  Newbie

Prepared Statement with in Clause
Posted by: Chris Aipperspach
Date: November 15, 2014 09:33AM

I'm trying to create a prepared statement with an in clause and have a few questions.

1. Is it easier to create two variable to hold the values?
2. Is there a better way to accomplish this?


PREPARE ProductQuery FROM 'select
prod.productname,prod.productline,count(prod.productCode) as counts
from
classicmodels.products prod where
prod.productline in (?)';

SET @pl = 'Classic Cars'',''Motorcycles';
EXECUTE ProductQuery USING @pl;

DEALLOCATE PREPARE ProductQuery;

Options: ReplyQuote


Subject
Written By
Posted
Prepared Statement with in Clause
November 15, 2014 09:33AM


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.