MySQL Forums
Forum List  »  InnoDB

Re: How to iterate trough list in string
Posted by: Rick James
Date: December 27, 2010 09:27AM

Things to try:
* send in the name of the temp table, then 'prepare' the query using a CONCAT to construct the query.
* If you have only thread on one client, then there is no ambiguity of temp table name, and the stored procedure could 'know' the name.

In a totally different approach, (ugly and limited):
SELECT @ids := GROUP_CONCAT(id SEPARATOR ',') FROM ... WHERE ...
Then pass the string @ids into the stored procedure, and construct (in the prepare) something like:
CONCAT('SELECT ... WHERE id IN (', ids, ')');

GROUP_CONCAT has a max string length.

Options: ReplyQuote


Subject
Views
Written By
Posted
4353
December 23, 2010 04:16AM
1441
December 24, 2010 10:59AM
Re: How to iterate trough list in string
1940
December 27, 2010 09:27AM
1328
December 28, 2010 03:35PM


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.