在sql下创建作业写的顺溜的,在oracle下不会了,感觉语法太麻烦了,尤其是返回数据集还得定义游标,包主体,包内容。。
哎,话说回来,如何创建啊,客户这边有个要求,要自动根据时间检查一个业务逻辑例如 cursor _cursor for select status,dataTime from A;
integer_status;
Date _dataTime;
....循环 游标放到_status中
if (时间与当前时间比较 并且标志位满足条件)
update ..................修改
就以上这种业务逻辑,然后将整个proc通过作业自动运行,并能设置频率和运行检查时间,谢谢
哎,话说回来,如何创建啊,客户这边有个要求,要自动根据时间检查一个业务逻辑例如 cursor _cursor for select status,dataTime from A;
integer_status;
Date _dataTime;
....循环 游标放到_status中
if (时间与当前时间比较 并且标志位满足条件)
update ..................修改
就以上这种业务逻辑,然后将整个proc通过作业自动运行,并能设置频率和运行检查时间,谢谢
create or replace procedure autoUpdate(status number,dateTime date) as
begin
for cur_row in select status,datatime from a loop
if(cur_row.datetime = sysdate and cur_row.status = x) then
update ........set ......;
end if;
commit;
end loop;
end----创建job
Begin
sys.dbms_job.submit(job => 301,
what => 'autoUpdate;',
next_date => to_date('2010-06-01', 'YYYY-MM-DD'),
interval => 'TRUNC(LAST_DAY(SYSDATE)+1)');
Commit;
End;
什么语法阿,oracle的真的是不太明白,嘿嘿