在表中循环插入日期 --创建会话级临时表 create global temporary table rq(id number primary key ,sj varchar2(20)) on commit preserve rows select * from rq --循环插入日期 declare c_i number :=1; v_i number ; v_firstday varchar2(20); v_lastday varchar(20); begin select to_char(sysdate,'yyyy-mm')||'-' into v_firstday from dual; select to_char(last_day(sysdate),'yyyy-mm-dd') into v_lastday from dual; select ceil(last_day(sysdate)-trunc(sysdate,'mm'))+1 into v_i from dual; loop insert into rq (id,sj) values(c_i,v_firstday||to_char(c_i)); c_i:=c_i+1; exit when c_i=v_i; end loop; end;