CREATE OR REPLACE PROCEDURE SP_DSSJTS_XMRSLOG
as
str1 varchar2(500);
str2 varchar2(500);
str3 varchar2(500);
begin
select 'xmrslog_'||extract(year from sysdate)||extract(month from sysdate) Into str1 from dual;
str2:='create table '||str1||' as select * from xmrslog';
str3:='delete xmrslog';
EXECUTE immediate str2;
EXECUTE immediate str3;
commit;--有进行回滚事物的就需要提交
end;
begin
sys.dbms_scheduler.create_job(job_name => 'XMGWY.SJTS_XMRSLOG_JOB',
job_type => 'STORED_PROCEDURE',
job_action => 'SP_DSSJTS_XMRSLOG',
start_date => to_date('02-01-2019 01:10:00', 'dd-mm-yyyy hh24:mi:ss'),
repeat_interval => 'Freq=MONTHLY;Interval=1',
end_date => to_date(null),
job_class => 'DEFAULT_JOB_CLASS',
enabled => true,
auto_drop => false,
comments => '');
end;
/