oracle的异常处理
Posted 闲莫等
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的异常处理的主要内容,如果未能解决你的问题,请参考以下文章
Oracle 数据库 - 使用UEStudio修改dmp文件版本号,解决imp命令恢复的数据库与dmp本地文件版本号不匹配导致的导入失败问题,“ORACLE error 12547”问题处理(代码片段
PCL异常处理:pcl 1.8.13rdpartyoostincludeoost-1_64oost ypeofmsvc ypeof_impl.hpp(125): error(代码片段