首页 > 代码库 > oracle的异常处理
oracle的异常处理
/** 写入自动施封命令:【同步webservice使用】 wyg 2017-03-12 */ PROCEDURE ISDT_VEHICLE_AutoLock(P_WID IN VARCHAR2, P_VEHICLENO IN VARCHAR2, P_STATE OUT INT, P_MSG OUT VARCHAR2) IS BEGIN insert into t_isdt_elockautorequest (requestid, wid, vehicleno, operatetype, created_date, last_updated_date) values (sys_guid(), P_WID, P_VEHICLENO, 1, sysdate, sysdate); COMMIT; P_STATE := 1; P_MSG := ‘success‘; EXCEPTION WHEN OTHERS THEN rollback; P_STATE := 0; P_MSG := SUBSTRB(‘line:‘ || dbms_utility.format_error_backtrace() || ‘ Occur error;‘ || SQLCODE || ‘,‘ || SQLERRM, 1, 200); END;
EXCEPTION WHEN DUP_VAL_ON_INDEX THEN INSERT INTO t_isdt_vehicle_track_err (car_num, gpstime, lon, lat, speed, direction, odometer, statusstr, placeroad, created_date, CREATED_BY) VALUES (P_CAR_NUM, P_GPSTIME, P_LON, P_LAT, P_SPEED, P_DIRECTION, P_ODOMETER, P_STATUSSTR, P_PLACEROAD, SYSDATE, 1); P_STATE := 0; P_MSG := SUBSTRB(‘line:‘ || dbms_utility.format_error_backtrace() || ‘ Occur error;‘ || SQLCODE || ‘,‘ || SQLERRM, 1, 200); COMMIT; WHEN OTHERS THEN ROLLBACK; P_STATE := 0; P_MSG := SUBSTRB(‘line:‘ || dbms_utility.format_error_backtrace() || ‘ Occur error;‘ || SQLCODE || ‘,‘ || SQLERRM, 1, 200);
显示结果:
ine:ORA-06512: 在 "employeDB.__DATA_SYNC", line 512
Occur error;-12899,ORA-12899: 列 "EMS"."T_ISDT_ELOCKAUTOREQUEST"."WID" 的值太大 (实际值: 137, 最大值: 50)
oracle的异常处理
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。