标签:
create or replace procedure p_test is
i number;
procedure p_testa is
CURSOR cur_order IS
select a.ol_id, a.so_date
from so.order_list@crmqry2 a WHERE a.status_cd not in (‘S‘,‘D‘,‘P‘,‘PR‘)
AND a.ol_type_cd <>6
AND a.channel_id not in (-10001, -10002, -10000, -10006, -10007)
and a.so_date > TRUNC(SYSDATE-1)
and a.ol_id=100582681691
AND a.so_date < TRUNC(SYSDATE);
TYPE t_order IS TABLE OF cur_order%ROWTYPE;
rec_order t_order;
BEGIN
OPEN cur_order;
LOOP
FETCH cur_order BULK COLLECT INTO rec_order LIMIT 40000;
EXIT WHEN rec_order.count =0;
FORALL i IN 1..rec_order.count
INSERT /*+ append */ INTO ygl_zc07_order_b VALUES rec_order(i);
COMMIT;
END LOOP;
CLOSE cur_order;
END p_testa;
--第二块取出退订实例
procedure p_testb is
begin
select /*+ driving_site(b)*/ count(*) into i
from ygl_zc07_order_b a, so.busi_order@crmqry2 b, so.oo_role@crmqry2 c
WHERE a.ol_id=b.ol_id
AND b.bo_id=c.bo_id
and b.ol_id=100582681691
AND c.obj_id IN (2, 9, 379)
AND c.state=‘DEL‘
AND c.offer_role_id IN (select x.offer_role_id from spec.offer_roles@crmqry2 x WHERE x.offer_spec_id IN (SELECT y.offer_spec_id FROM spec.offer_spec@crmqry2 y WHERE y.offer_type_cd=1));
dbms_output.put_line(i);
END p_testb;
begin
execute immediate ‘truncate table ygl_zc07_order_b‘;
execute immediate ‘truncate table ygl_zc07_prod_b‘;
commit;
p_testa;
p_testb;
end p_test;
CREATE OR REPLACE PROCEDURE ygl_time(mins NUMBER) IS
t_a DATE := SYSDATE;
t_b DATE;
BEGIN
t_b := t_a + mins / (24 * 60 * 60);
WHILE SYSDATE < t_b LOOP
NULL;
END LOOP;
RETURN;
EXCEPTION
WHEN OTHERS THEN
NULL;
RETURN;
END;
使用drving_site处理DBLINK数据的无数据的问题
标签:
原文地址:http://www.cnblogs.com/highroom/p/80c60bf52bfe7af79162e9a3d607ad54.html