一些数据库的循环方法:
Mysql
????set v_date = begin_date;
????while v_date < end_date do
????????set v_begin_date = DATE_FORMAT(v_date,‘%Y-%m-%d‘);
????????set v_end_date = DATE_FORMAT(v_date,‘%Y-%m-%d‘);
????????select v_begin_date, v_end_date;
????????-- write your sql here!
-- call myLoop(‘2013-08-15‘,‘2013-09-02‘);
?
?
Oracle
???????v_date := date‘2014-06-02‘;
?????????????v_begin_date := to_char(v_date, ‘yyyy-mm-dd‘);
?????????????v_date := v_date + 1;
?????????????v_end_date := to_char(v_date, ‘yyyy-mm-dd‘);
?????????????dbms_output.put_line(v_begin_date||‘ === ‘||v_end_date);
?????????????-- write your sql here!
一些数据库的循环方法
原文:http://www.cnblogs.com/lucky110100/p/4095528.html