Subject Re: [firebird-support] Custom error message from procedure/trigger code in Firebird 3.x dialect 3
Author Helen Borrie
jonatan.lauritsen@... wrote:

> Sometimes I need to write extended error message from the SQL
> procedure and trigger code. So far I have used the following procedure:

> create or alter procedure REPORT_ERROR (MSG varchar(400))as
> BEGIN

> update rdb$exceptions set

> rdb$message=:MSG where rdb$exception_name='MY_ERROR';
> exception ERRMSG_;
> END

This was always a hack...

> But in Firebird 3.x UTF8/dialect 3 I am receiving the error message
> while using this function (even as SYSDBA user):

> UPDATE operation is not allowed for system table RDB$EXCEPTIONS.

And here's where the hack comes back to bite you. System tables from
v.3.0 onward are read-only, meaning, amongst other things, you can no
longer circumvent the restriction on performing DDL operations in PSQL
by hitting the system tables directly.

> So - how can I report custom errors from the SQL procedures and
> triggers, it would be nice the generate some information in
> procedures and triggers and let the Delphi error-handling code to
> process this information for the user presentation.

Since around v.2.0, you have been able to replace the default message
associated with an exception with a run-time message of up to approx.
1000 characters (ascii) or around 250 (UTF-8). See
https://www.firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-psql-handleexceptions.html#fblangref25-psql-exception



---
This email has been checked for viruses by AVG.
https://www.avg.com