By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,403 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,403 IT Pros & Developers. It's quick & easy.

myqsl stored procedure passing comma seperated list as parameter

P: 29
Hi All,

I have one problem here with mysql stored procedures.

I have a list of ids seperated by comma e.g., (" 'A', 'B', 'C' "). I am passing the same to mysql stored procedure as a parameter. I want to use these values in where clause of select statement using IN.

I can't use prepared statements because queries written in stored procedure are very complex.
Aug 21 '08 #1
Share this Question
Share on Google+
1 Reply


P: 7
You could use a function to split the the string like one of these :
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50648

The first one returns a table and you could query that table into the IN part of your query.

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM some_table WHERE id IN (SELECT id FROM func_table)
  2.  
Aug 22 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.