Dynamic SQL would work for Imbedding String for the IN clause.
That would be too messy for such a little query.

Here is a crazy suggestion

CREATE PROCEDURE additems ()
   BEGIN
     DECLARE grammatures VARCHAR(128) DEFAULT '7,12,1,13,2,5,14,21';
     DECLARE newids VARCHAR(128);

     SELECT GROUP_CONCAT(a_id,newids) INTO newids FROM articles WHERE 
INSTR(CONCAT(',',grammatures,','),CONCAT(',',article_grammatures,',')) > 0

       SELECT @newids;
   END;

By the way, is it ' article_grammature ' or ' article_garmmature ' ?

Give it a try !!!

-----Original Message-----
From: Barry [mailto:[EMAIL PROTECTED]
Sent: Friday, February 15, 2008 5:28 AM
To: mysql@lists.mysql.com
Subject: Stored Procedure problem

Hello everyone!

Hopefully somone can enlight me, i am hanging on this vor a few hours now :/

i have this stored procedure:

CREATE PROCEDURE additems ()
   BEGIN
     DECLARE grammatures VARCHAR(128) DEFAULT '7,12,1,13,2,5,14,21';
     DECLARE newids VARCHAR(128);

     SELECT GROUP_CONCAT(a_id,newids) INTO newids
       FROM articles
       WHERE article_garmmature IN (grammatures);

       SELECT @newids;
   END;


What i wan't is to store the id's as a comma seperated list into the
newids VAR.

I get the error that there is more than one result set.

I also tried group_concat, but that didn't worked :(

Anyone has an idea how to store multiple ids into one VAR ?

Thanks for reading!

Best wishes
        Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to