1

I am passing dates as comma separated values eg. param1 = 2012-01-12,2013-02-15,2012-12-01 and this will be input to my procedure and how can I get values of all the dates which are passed as parameter to my procedure.

I have tried using : select value from table1 where date_value in (param1); but it is giving me a empty set.

Please tell me how to solve it.

Update:

DELIMITER $$
CREATE FUNCTION test2(dates text)
RETURNS text  READS SQL DATA
BEGIN
DECLARE abc text;
DECLARE hi text;

SET hi= concat('''',regex_replace('[,]',''',''',dates),'''');

select value into abc from table1 where date_time in (hi);

RETURN abc;
END;
$$
DELIMITER ;

My Input to this function will be multiple dates: e.g: 2010-12-12,2012-12-10,.....

And My regex_replace function will return me the date in this format: '2010-12-12','2012-12-10' and setting this to a variable and passing it.

But I always get a empty set. Where have I gone wrong?

4

1 に答える 1