CREATE OR REPLACE PROCEDURE DELETE_2000W_DATA IS
TM_COUNT NUMBER(3);
ERR_CODE VARCHAR2(200); --错误码
ERR_MSG VARCHAR2(2000); – 错误信息
begin
select count(*) into TM_COUNT from tt_waybill_additional t where t.waybill_no='xxxx' and rownum<2;
if TM_COUNT = 0 then -- 数据删完了,直接退出;
return ;
end if;
insert into temp_waybill_id select t.waybill_id from tl_waybill_additional t where t.waybill_no='xxxx';
delete from tt_waybill_additional t where t.waybill_id in (select waybill_id from temp_waybill_id);
delete from tt_waybill_consign t where t.waybill_id in (select waybill_id from temp_waybill_id);
delete from tt_waybill_service t where t.waybill_id in (select waybill_id from temp_waybill_id);
delete from tt_waybill_fee t where t.waybill_id in (select waybill_id from temp_waybill_id);
commit;
delete from temp_waybill_id where 1=1;
end DELETE_2000W_DATA;
declare
job number(20);
begin
sys.dbms_job.submit(job => job,
what => ‘P_RESEND_OTH_WAYBILL;’,
next_date => sysdate,
interval => ’ sysdate+2/24/60’);
commit;
end;