通过调用相同的程序解决关键字?

时间:2014-03-24 07:56:17

标签: oracle oracle10g

因为continue关键字不能工作因为以下原因我尝试通过调用相同的过程并将记录中的下一个值传递给它来解决这个问题 那是正确的方法吗?

  

ORA-06550:第1行第26列:PLS-00201:标识符'CONTINUE'必须是   声明ORA-06550:第1行,第26列:PL / SQL:忽略语句

declare 
cust_id info.CUSTOMER_ID@prod%type;
V_CUST_INFO_CUSTOMER_ID FEB_PRD_14_VIEW.CUST_INFO_CUSTOMER_ID@rtx%type;
V_INITIAL_START_TIME_TIMESTAMP FEB_PRD_14_VIEW.INITIAL_START_TIME_TIMESTAMP@rtx%type;

cursor rated_rejectes_calls_cursor is 
select S_P_NUM,CALL_START_TIME
from fi_sdine.rejected_calls_87@prod 
where UPPER (STATUS)='RATED';

begin
for rated_rejectes_calls_rec in rated_rejectes_calls_cursor
loop
if (rated_rejectes_calls_rec.S_P_NUM is not null) then

begin

select CUSTOMER_ID into cust_id from bmh.info@prod where dn_num=rated_rejectes_calls_rec.S_P_NUM;

if (V_CUST_INFO_CUSTOMER_ID is null ) then
select CUST_INFO_CUSTOMER_ID, INITIAL_START_TIME_TIMESTAMP into V_CUST_INFO_CUSTOMER_ID,V_INITIAL_START_TIME_TIMESTAMP 
from FI_MASAAD.FEB_PRD_14_VIEW@rtx a
where  CUST_INFO_CUSTOMER_ID =cust_id
and INITIAL_START_TIME_TIMESTAMP=rated_rejectes_calls_rec.CALL_START_TIME 
group by CUST_INFO_CUSTOMER_ID,INITIAL_START_TIME_TIMESTAMP;

DBMS_OUTPUT.PUT_LINE('null NOT Found '||V_CUST_INFO_CUSTOMER_ID);

end if;

dbms_output.put_line('The customer ID for S_P_NUM '||rated_rejectes_calls_rec.S_P_NUM||' is '||cust_id|| ' and the call start time is  '||rated_rejectes_calls_rec.CALL_START_TIME||' has been found' );
dbms_output.put_line('The customer ID'||V_CUST_INFO_CUSTOMER_ID||' and call start is '||V_INITIAL_START_TIME_TIMESTAMP);

exception 

when no_data_found then
dbms_output.put_line('The Customer ID NOT FOUND FOR S_P_NUM '|| rated_rejectes_calls_rec.S_P_NUM);
 --contunie;
-- recall procedure and pass the next value to same procedure ?
exec check_rejected_CDRs(rated_rejectes_calls_rec.nextval);

end;
end if;
end loop;
end;
end check_rejected_CDRs;

1 个答案:

答案 0 :(得分:0)

您的异常处理程序可能位于错误的位置。 我你正试图实现这个目标......

declare

cust_id info.CUSTOMER_ID@prod%type;
V_CUST_INFO_CUSTOMER_ID FEB_PRD_14_VIEW.CUST_INFO_CUSTOMER_ID@rtx%type;
V_INITIAL_START_TIME_TIMESTAMP FEB_PRD_14_VIEW.INITIAL_START_TIME_TIMESTAMP@rtx%type;

cursor rated_rejectes_calls_cursor is 
select S_P_NUM,CALL_START_TIME
from fi_sdine.rejected_calls_87@prod 
where UPPER (STATUS)='RATED';

begin
for rated_rejectes_calls_rec in rated_rejectes_calls_cursor
loop
    if (rated_rejectes_calls_rec.S_P_NUM is not null) then

    begin

         select CUSTOMER_ID into cust_id from bmh.info@prod where dn_num=rated_rejectes_calls_rec.S_P_NUM;

         if (V_CUST_INFO_CUSTOMER_ID is null ) then

            BEGIN 



            select CUST_INFO_CUSTOMER_ID, INITIAL_START_TIME_TIMESTAMP into V_CUST_INFO_CUSTOMER_ID,V_INITIAL_START_TIME_TIMESTAMP
            from FI_MASAAD.FEB_PRD_14_VIEW@rtx a
            where  CUST_INFO_CUSTOMER_ID=cust_id
            and INITIAL_START_TIME_TIMESTAMP=rated_rejectes_calls_rec.CALL_START_TIME
            group by CUST_INFO_CUSTOMER_ID,INITIAL_START_TIME_TIMESTAMP;

            DBMS_OUTPUT.PUT_LINE('null NOT Found '||V_CUST_INFO_CUSTOMER_ID);   

异常                 当no_data_found然后                     dbms_output.put_line('未找到S_P_NUM的客户ID'|| rated_rejectes_calls_rec.S_P_NUM);                     exec check_rejected_CDRs(rated_rejectes_calls_rec.nextval);                 END;

         end if;

         dbms_output.put_line('The customer ID for S_P_NUM '||rated_rejectes_calls_rec.S_P_NUM||' is '||cust_id|| ' and the call start time is  '||rated_rejectes_calls_rec.CALL_START_TIME||' has been found' );
         dbms_output.put_line('The customer ID'||V_CUST_INFO_CUSTOMER_ID||' and call start is '||V_INITIAL_START_TIME_TIMESTAMP);

    end;

    end if;

end loop;

end;

end check_rejected_CDRs;