请帮助看看下面的存储过程是否会被dbms—job调用?
游标定义是选择了多表是否会有问题?谢谢create or replace procedure datetalinset
is
v_bar_id internetbar.bar_id%type;
v_bar_name internetbar.bar_name%type;
v_mac computer.comp_mac%type;
v_ip computer.comp_outerip%type;
v_stat Integer;
v_ietimes Integer;
v_desktimes Integer;
CURSOR c_comp IS SELECT count(cs.stat_status) FROM computer c,computerstatus cs where c.comp_mac=cs.comp_mac and cs.stat_status='start';
cursor c_bar is select bar.bar_id,bar.bar_name,c.comp_mac,c.comp_outerip from internetbar bar,computer c where bar.bar_id=c.bar_id(+);
pragma autonomous_transaction;
begin
open c_bar;
loop
fetch c_bar into v_bar_id,v_bar_name,v_mac,v_ip;
open c_comp;
loop
fetch c_comp into v_stat;
select count(ad.adres_type)
into v_ietimes
from adclickrecord ad
where ad.comp_mac=v_mac
and ad.adrec_date=to_date(sysdate,'yyyy-mm-dd')
and ad.adres_type=1;
select count(ad.adres_type)
into v_desktimes
from adclickrecord ad
where ad.comp_mac=v_mac
and ad.adrec_date=to_date(sysdate,'yyyy-mm-dd')
and ad.adres_type=2;
insert into datetotal(bar_id,rec_date,comp_mac,comp_outerip,stat_beat_long,ad_desk_times,ie_desk_times)
values( v_bar_id,sysdate,v_mac,v_ip,v_stat*0.5,v_desktimes,v_ietimes);
exit when c_comp %notfound;
end loop;
close c_comp;
exit when c_bar%notfound;
end loop;
close c_bar;end datetalinset;下面为此存储过程的定时器DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X,
what => 'datetalinset();',
next_date => to_date('24/04/2008 00:00:00','dd/mm/yyyy hh24:mi:ss'),
interval => 'sysdate+1',
no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: '|| to_char(x));
COMMIT;
END;
/
游标定义是选择了多表是否会有问题?谢谢create or replace procedure datetalinset
is
v_bar_id internetbar.bar_id%type;
v_bar_name internetbar.bar_name%type;
v_mac computer.comp_mac%type;
v_ip computer.comp_outerip%type;
v_stat Integer;
v_ietimes Integer;
v_desktimes Integer;
CURSOR c_comp IS SELECT count(cs.stat_status) FROM computer c,computerstatus cs where c.comp_mac=cs.comp_mac and cs.stat_status='start';
cursor c_bar is select bar.bar_id,bar.bar_name,c.comp_mac,c.comp_outerip from internetbar bar,computer c where bar.bar_id=c.bar_id(+);
pragma autonomous_transaction;
begin
open c_bar;
loop
fetch c_bar into v_bar_id,v_bar_name,v_mac,v_ip;
open c_comp;
loop
fetch c_comp into v_stat;
select count(ad.adres_type)
into v_ietimes
from adclickrecord ad
where ad.comp_mac=v_mac
and ad.adrec_date=to_date(sysdate,'yyyy-mm-dd')
and ad.adres_type=1;
select count(ad.adres_type)
into v_desktimes
from adclickrecord ad
where ad.comp_mac=v_mac
and ad.adrec_date=to_date(sysdate,'yyyy-mm-dd')
and ad.adres_type=2;
insert into datetotal(bar_id,rec_date,comp_mac,comp_outerip,stat_beat_long,ad_desk_times,ie_desk_times)
values( v_bar_id,sysdate,v_mac,v_ip,v_stat*0.5,v_desktimes,v_ietimes);
exit when c_comp %notfound;
end loop;
close c_comp;
exit when c_bar%notfound;
end loop;
close c_bar;end datetalinset;下面为此存储过程的定时器DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X,
what => 'datetalinset();',
next_date => to_date('24/04/2008 00:00:00','dd/mm/yyyy hh24:mi:ss'),
interval => 'sysdate+1',
no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: '|| to_char(x));
COMMIT;
END;
/
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货