在Oracle数据库中创建一个触发器:要求在每天上午8点清空test表中的所有数据
追问:没用过定时器,你能给发个代码吗?创建定时器时报错了:
先创建一个存储过程用来删除数据:
create or replace procedure pro_clear is
begin
delete from eee;
commit;
end;
然后创建定时器
declare
jobno number;
begin
dbms_job.submit(
job => jobno,
what => 'pro_clear;',
Interval=>'TRUNC(sysdate)+1+28/(24)');
commit;
end;
你刚才发的代码里有缺失关键字我加上了,存储过程有了。提示定时器的第一行报错了:declare ,我百度了一下创建定时器的代码,发现没有什么错误了啊,怎么创建不了呢create or replace procedure pro_clear as
begin
delete from eee;
commit;
end;
commit;
然后创建定时器
declare
jobno number;
begin
dbms_job.submit(
job=>jobno,
what => 'pro_clear;',
Interval=> 'TRUNC(sysdate)+1+2/(24)'
);
commit;
end;
无语问苍天,错误在哪里