【发布时间】:2012-05-08 19:58:04
【问题描述】:
我有这个程序:
create or replace PROCEDURE MyProc
(
<some-parameters>
)
AS
BEGIN
if(<some-condition>) then
RAISE_APPLICATION_ERROR('my custom error message');
end if;
END;
当从 C# 调用它时:
try
{
<call procedure>
}
catch(OracleException x)
{
lblMessage.Text = x.Message;
}
我收到如下错误消息:
ORA-28008: my custom error message ORA-06512: at blah, line blah ORA-06512: at line blah
我只想要:
my custom error message
没有内部异常。错误收集没有帮助。使用 Exception 而不是 OracleException 时的情况相同。
我错过了什么?
我可以使用字符串操作,但错误消息的格式有多固定?
【问题讨论】:
-
自定义错误消息的 ORA-xxxxx 编号是否对于每条错误消息都是唯一的?