如何在 "when any" 块中获取与 Firebird SQL 异常关联的文本?
How do I get the text associated with a Firebird SQL exception in a "when any" block?
我在 Firebird(2.1 版)存储过程中有以下内容。当发生异常时,我得到 GDSCODE 和 SQLCODE,但我不知道如何获得错误附带的描述性错误消息文本。有可能这样做吗?是否有像 SQLERRORTEXT 之类的变量?我搜索 Google 没有找到任何结果。
begin
insert into BOOKING_STATUS (status_id, description) values ("test1", "test1");
when any do begin
error_code = 1;
error_message = "Error inserting booking_status. Error: " || GDSCODE || " " || SQLCODE;
suspend;
exit;
end
end
不幸的是,这在您的 firebird 版本中是不可能的。看看this request.
事实证明,这个工具存在于 Firebird 4.0+ 中。
类似问题:
In FirebirdSql, how to return exception message from procedure
Firebird - handling exception's custom-message
我在 Firebird(2.1 版)存储过程中有以下内容。当发生异常时,我得到 GDSCODE 和 SQLCODE,但我不知道如何获得错误附带的描述性错误消息文本。有可能这样做吗?是否有像 SQLERRORTEXT 之类的变量?我搜索 Google 没有找到任何结果。
begin
insert into BOOKING_STATUS (status_id, description) values ("test1", "test1");
when any do begin
error_code = 1;
error_message = "Error inserting booking_status. Error: " || GDSCODE || " " || SQLCODE;
suspend;
exit;
end
end
不幸的是,这在您的 firebird 版本中是不可能的。看看this request.
事实证明,这个工具存在于 Firebird 4.0+ 中。
类似问题:
In FirebirdSql, how to return exception message from procedure
Firebird - handling exception's custom-message