我有一个异常块的以下过程。当我执行此过程时,系统正在捕获错误而不是我的异常块。任何人都对我做错了什么有任何想法。感谢
CREATE OR REPLACE PROCEDURE ADD_ORDER
(CUST_NUM IN CUSTOMERS_T_P2.CNO%TYPE,
EMP_NUM IN EMPLOYEE_T_P2.ENO%TYPE,
REC_DATE IN ORDERS_T_P2.RECEIVED%TYPE)
IS
BEGIN
IF REC_DATE IS NULL THEN
INSERT INTO ORDERS_T_P2 (ONO, CNO, ENO, RECEIVED)
VALUES
(ORDER_NUMBER_SEQ.NEXTVAL, CUST_NUM, EMP_NUM, SYSDATE);
ELSE
INSERT INTO ORDERS_T_P2 (ONO, CNO, ENO, RECEIVED)
VALUES
(ORDER_NUMBER_SEQ.NEXTVAL, CUST_NUM, EMP_NUM, REC_DATE);
END IF;
EXCEPTION
WHEN VALUE_ERROR THEN
ROLLBACK WORK;
INSERT INTO ORDER_ERRORS_T_P2
VALUES
(ORDER_NUMBER_SEQ.NEXTVAL, SYSDATE, 'STRING WAS ENTERED INSTEAD OF NUMBER');
DBMS_OUTPUT.PUT_LINE('STRING WAS ENTERED INSTEAD OF NUMBER');
END;
答案 0 :(得分:0)
VALUE_ERROR应在DECLARE块
中声明为ExceptionCREATE OR REPLACE PROCEDURE ADD_ORDER
(CUST_NUM IN CUSTOMERS_T_P2.CNO%TYPE,
EMP_NUM IN EMPLOYEE_T_P2.ENO%TYPE,
REC_DATE IN ORDERS_T_P2.RECEIVED%TYPE)
IS
VALUE_ERROR EXCEPTION;
BEGIN
---------------