create or replace create_table is dd varchar2(20); begin select col into dd from t1 where rownum=1 --dd:='2005/10/01'; if sysdate>to_date(dd, 'yyyy/mm/dd') then execute immediate 'create table ||to_char(sysdate, 'yyyy/mm/dd')||' col1.....'; dd:=to_char(add_months(sysdate+1), 'yyyy/mm/dd'); update t1 set col=dd; end if; commit; end;--定时脚本 variable a number; begin dbms_job.submit(:A, 'create_table;', sysdate, 'sysdate+1'); commit; end;
dd varchar2(20);
begin
select col into dd from t1 where rownum=1 --dd:='2005/10/01';
if sysdate>to_date(dd, 'yyyy/mm/dd') then
execute immediate 'create table ||to_char(sysdate, 'yyyy/mm/dd')||' col1.....';
dd:=to_char(add_months(sysdate+1), 'yyyy/mm/dd');
update t1 set col=dd;
end if;
commit;
end;--定时脚本
variable a number;
begin
dbms_job.submit(:A, 'create_table;', sysdate, 'sysdate+1');
commit;
end;