--日志抽取
procedure extract_bte_logMain(pStTime varchar2, pEndTime varchar2) is
pLogStr varchar2(4000) := ' select dataId,opertype,datatype,logtime from t_content_release_log@btepublish_';
cLog C;
bteLogInfo BTELOG ;
newInfo t_info_upd_log%rowtype;
iCount number(10) := 0 ;
begin
--对本地网循环
--for t in (select distinct city_no from icrm_t_area where city_no <> 0 )
--测试阶段 暂用020
del_t_info_upd_log(to_date(pStTime,'yyyy-mm-dd hh24:mi:ss'),to_date(pEndTime,'yyyy-mm-dd hh24:mi:ss'));
commit;
for t in (select distinct city_no from icrm_t_area where city_no = '020' ) loop
pLogStr := pLogStr || t.city_no || ' where logtime >= to_date('''||pStTime||''', ''yyyy-mm-dd hh24:mi:ss'') and
logtime <= to_date('''||pEndTime||''',''yyyy-mm-dd hh24:mi:ss'')';
open cLog for pLogStr ;
loop
fetch cLog into bteLogInfo ;
exit when cLog%notfound;
newInfo.Info_Type := bteLogInfo.datatype;
newInfo.Info_Id := bteLogInfo.dataId;
newInfo.Create_Time := bteLogInfo.logtime;
if upper(bteLogInfo.operatype) in ('P','A','B','U') then
newInfo.Operate_Type := 'U';
else
newInfo.Operate_Type := upper(bteLogInfo.operatype);
end if;
ins_t_info_upd_log(newInfo);
iCount := iCount + 1;
if mod(iCount,1000) = 0 then
commit;
end if;
end loop;
close cLog;
commit;
end loop;
exception when others then
rollback;
end;