作业调用程序过程实现数据导入
create or replace procedure prc_receivenewdata
IS
/*声明游标*/
cursor cursor_purchid is select purchid from eetedm.mid_purchase@sccx.oracle.dblink t1
where flag = 0 for update of flag ;
pid purchase.purchid%type;
purchcount number(10);
begin
select count(*) into purchcount from eetedm.mid_purchase@sccx.oracle.dblink where flag = 0 ;
if purchcount> 0 then
open cursor_purchid;
loop
fetch cursor_purchid into pid;
EXIT WHEN cursor_purchid%NOTFOUND;
insert into purchase
select * from eetedm.mid_purchase@sccx.oracle.dblink where purchid = pid ;
insert into purchdetail(
PURCHID ,
LINENO ,
ILISTNUM ,
ORDERQTY ,
ORDERUNIT ,
UNITCOST ,
LINECOST ,
VENDORTASK ,
VENDORDATE ,
CIQDATE ,
ENTRYPROTDATE ,
ENTRYPORT ,
TOCOMPANY ,
TOCOMINCEPTOR ,
CHANGEBY ,
CHANGEDATE ,
MGID ,
ENTID ,
PAYTIME ,
BEDATE ,
PURCHPARENT ,
QLINENO &nb