Subject Re: [firebird-support] How To raise system exception, or set gds/sql code to custom value
Author Adomas Urbanavicius
Sorry, let me explain more :
If there is table with PK, so if we are trying to enter dublicate
value, we get exception. GDSCODE unique_key_violation

And application receives gdscode 335544665 (or sql code -803).

I need to fire same exception manually in custom trigger, that application faced same behavior as inserting dublicate into PK.
Something like: App does custom job:SP,several inserts, whatever : receives exeption unique_key_violation, but in DB that exception is generated by custom trigger,not by PK contraint.

Adomas




Helen Borrie wrote:


>At 03:53 PM 27/09/2005 +0300, you wrote:
>
>
>>Hi,
>> Is there possible to raise system exception in my own trigger , or
>>to set gds/sql code to custom value ?.
>> I need to raise system exception manually (unique_key_violation) .
>> As far as I understand it is enough to set gds/sql code to custom value.
>> I Tried various cases (set gdscode=..,sqlcode=..), but couldnt get
>>results.
>>
>>
>
>create exception My_Unique_Key_Violation 'This is a custom exception
>message 78 bytes or less';
>
>
>.....
>WHEN GDSCODE unique_key_violation do
>begin
> whatever;
> exception My_Unique_Key_Violation;
>end
>....
>
>Is that what you are after?
>
>./heLen
>
>
>
>
>
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Visit http://firebird.sourceforge.net and click the Resources item
>on the main (top) menu. Try Knowledgebase and FAQ links !
>
>Also search the knowledgebases at http://www.ibphoenix.com
>
>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>