-2
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_daterangeUpdate`(IN courseTypeID INT,IN courseYear TEXT,IN dateRangeString TEXT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS normalDayOrder;
CREATE TEMPORARY TABLE normalDayOrder(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
dayID INT(11) NOT NULL
);
INSERT INTO normalDayOrder(dayID) values(1),(2),(3),(4),(5),(6),(7);
BEGIN
DECLARE day_done BOOLEAN DEFAULT FALSE;
DECLARE day_cur CURSOR FOR SELECT * FROM normalDayOrder;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET day_done =TRUE;
END;
OPEN day_cur;
dayorder_loop: LOOP
FETCH day_cur INTO id,dayID;
IF day_done THEN
LEAVE dayorder_loop;
END IF;
SELECT id,dayID;
END LOOP dayorder_loop;
END