declare
--类型定义
cursor c_eventstate
is
Select CampaignId,phonenumber,PolicyNumber from mkt_eventstate a where synstate =0 and packagestate = 2 and errorcode = 6;
--定义一个游标变量v_cinfo c_emp%ROWTYPE ,该类型为游标c_emp中的一行数据类型
c_row c_eventstate%rowtype;
begin
for c_row in c_eventstate loop
begin
dbms_output.put_line(c_row.CampaignId||'-'||c_row.phonenumber||'-'||c_row.PolicyNumber);
RAISE_APPLICATION_ERROR(-20001,'数值不能为0');
EXCEPTION
--捕捉异常
WHEN others THEN
DBMS_OUTPUT.put_line('捕获了错误begin');
dbms_output.put_line(c_row.PolicyNumber);
DBMS_OUTPUT.put_line('捕获了错误end');
end;
end loop;
end;