DB2 异常处理 [英] DB2 Exception handling

查看:24
本文介绍了DB2 异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临的问题主要是异常处理!当发生异常时,我想将该数据与错误消息一起放在另一个日志表中.但是,在 DB2 中,我无法找到一种方法来检索引发的 SQLSTATE 的相应错误消息.

The problem that I am facing is primarily on Exception Handling! When an exception occurs I want to put that data in another log table with the error message. However, in DB2 I am not able to figure out a way to retrieve the corresponding error message for the raised SQLSTATE.

PS:我有一个用于此迁移的存储过程,我没有使用任何其他语言来调用它.

PS: I have a stored procedure for this migration and I am not using any other language to call it.

我们可以通过 oracle 中的 SQLERRM 来做到这一点;可能它应该是一件小事,但由于一些奇怪的原因我还没有找到它!

We could do this through SQLERRM in oracle; probably it should be a small thing, still for some strange reasons I have not been able to find it yet!

希望您对此有所了解,;-).我只需要一个指针.

Hopefully you would have an idea on this, ;-). I just need a pointer on this.

谢谢,

哈维尔乌帕尔

推荐答案

你应该可以使用 DB2Exception.Message 属性.

You should be able to get in the front-end code using DB2Exception.Message property.

这篇关于DB2 异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆