BEGIN
SELECT CAPTURE_RATE
INTO LDEC_UNITCAPTURE_RATE
FROM PARA_CAPTURE
WHERE AREAID = AS_AREAID
AND INSURANCE_TYPE = AS_INSURANCE_TYPE
AND CAPTURE_STYLE = AS_UNITCAPTURE_STYLE
AND START_MONTH <= AS_CAPTURE_MONTH
AND (END_MONTH > AS_CAPTURE_MONTH OR END_MONTH IS NULL); IF LDEC_UNITCAPTURE_RATE IS NULL THEN
po_fhz:='-1';
po_msg:='调用存储过程时,单位缴费比例没有被定义,类别:' || LS_UNITCAPTURE_STYLE;
RETURN;
END IF; EXCEPTION
WHEN NO_DATA_FOUND THEN
po_fhz:='-1';
po_msg:='调用存储过程时,单位缴费比例没有被定义,类别:' || LS_UNITCAPTURE_STYLE;
RETURN;
WHEN TOO_MANY_ROWS THEN
po_fhz:='-1';
po_msg:='调用存储过程时,单位缴费比例没有被定义,类别:' || LS_UNITCAPTURE_STYLE;
RETURN;
WHEN OTHERS THEN
po_fhz:='-1';
po_msg:='调用存储过程时,取单位缴费比例时错误原因:'||sqlerrm;
RETURN;
END;
首先定义一个异常:
exception_name exception;
然后触发一个异常:
raise excepiton_name;
处理异常:
when excetption_name then
dbms_output.put_line('添加出错!');