SQL Server和oracle在存储过程查看异常信息

SQL Server:
begin try
......
end try
begin catch
    print('--------------------exception-----------------------');
    print(@@ERROR);
    PRINT('ERROR_NUMBER=' + STR(ERROR_NUMBER()));
	PRINT('ERROR_SEVERITY=' + STR(ERROR_SEVERITY()));
	PRINT('ERROR_STATE=' + STR(ERROR_STATE()));
	PRINT('ERROR_MESSAGE=' + ERROR_MESSAGE());
    rollback;
end catch




Oracle:
exception WHEN others THEN
   dbms_output.PUT_LINE(sqlerrm);
   rollback;
end;

猜你喜欢

转载自panyongzheng.iteye.com/blog/1616695