Subject | Re: How to prevent inserting? |
---|---|
Author | vp_email@yahoo.com |
Post date | 2001-07-18T09:36:16Z |
--- In ib-support@y..., "Fabrice Aeschbacher"
<fabrice.aeschbacher@k...> wrote:
I just want to prevent inserting a record in the table. Without
saying a word, in silence.
I don't want undoing ALL changes. I want to fail inserting a record.
In silence.
There is a solution:
1) change ID field to "0" (zero)
2) let the record to insert
3) in the trigger "after insert" delete the record where ID = 0
That works, but makes garbage...
Are there any solutions?
--
Best regards, Vadim
vp_email@...
<fabrice.aeschbacher@k...> wrote:
> Try:[skipped]
> CREATE EXCEPTION PREVENT_INSERTING 'The record was not inserted
> because...';
> And then, in you trigger:
> EXCEPTION PREVENT_INSERTING;syntax:
> Raising an exception in a trigger
> To raise an existing exception in a trigger, use the following
> EXCEPTION name;I don't want to warn a user about key violation or something else.
> where name is the name of an exception that already exists in the
> database.
I just want to prevent inserting a record in the table. Without
saying a word, in silence.
>Raising an exception:... and undoing any changes, made in the same transaction.
> -Terminates the trigger, undoing any changes caused (directly or
> indirectly) by the trigger.
I don't want undoing ALL changes. I want to fail inserting a record.
In silence.
There is a solution:
1) change ID field to "0" (zero)
2) let the record to insert
3) in the trigger "after insert" delete the record where ID = 0
That works, but makes garbage...
Are there any solutions?
--
Best regards, Vadim
vp_email@...