Howdy all. I need to define a cursor in a stored procedure but I don't know what the nature of the select statement is going to be until runtime. I need to do something like the code below:
IF (INSTR(city_name, ',') > 0) THEN DECLARE cur_neighborhood CURSOR FOR SELECT DISTINCT neighborhood FROM listing WHERE FIND_IN_SET(city, city_name); ELSE DECLARE cur_neighborhood CURSOR FOR SELECT DISTINCT neighborhood FROM listing WHERE city = city_name; END IF; MySQL doesn't like this syntax. Is there a way that I can accomplish this? Cheers, Tripp __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]