Subject Re: [firebird-support] Exception with a parameter
Author Martijn Tonies
Hello Christian,

> is there a way to add a parameter to an exception which
> is displayed in the exception text?
>
> Something like this:
>
> CREATE EXCEPTION E_PA_CM_VERTRAG_NICHT_GEFUNDEN
> 'Contract <Param> was not found.'

Nope, this cannot be done.

> IF (L_Id IS NULL) THEN
> EXCEPTION E_Pa_Cm_Vertrag_Nicht_Gefunden('434');
>
> This should result in the message
> 'Contract 434 not found.' when the exception is fired.
>
> I am using FB 1.50 and I thought I had heard about parameterized
> exceptions, but I cannot find anything in the release notes.

Well, I think you should be able to re-create the message from the
exception. Can't remember exactly how though :-/

Ah, found it in the "readme" doc of Fb 1.5...

>>
1. EXCEPTION E_EXCEPTION_1 'Error!';
2. EXCEPTION E_EXCEPTION_2 'Wrong type for record with ID=' || new.ID;
>>


With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server
Upscene Productions
http://www.upscene.com