Creating a Trigger

Beatrix Willius bwillius at gmx.de
Sun Jan 4 12:02:44 CST 2009


Hi Ivan,

thanks for the as usual fast answer.

On 04.01.2009, at 18:33, Ivan Smahin wrote:

>> create trigger MailboxnameChange after update on Mailbox
>>         begin
>>         end;
>
> It should be
> create trigger MailboxnameChange after update on Mailbox
> FOR EACH ROW
> or FOR EACH STATEMENT

No, doesn't work. I still get the same error.
>
> It is hardly possible with triggers. Because of you are going to
> update the same table on 'update' event. FOR EACH ROW or
> FOR EACH STATEMENTS will be fired trigger again and again.
>
> It could be powered by the link of any type (most nature way).

With this I get recursive SQL queries, don't I?
>
> One more solution is stored procedures.
> So you will not call update for this table but some SP which will do
> all changes self.

Could you explain in a bit more detail what you mean with this?  
Haven't used stored procedures before.

> One more "solution"
> You can do the trick inside the trigger
>
> first line is:
> ALTER TRIGGER trigger1 DISABLE;
> then do update the childs (trigger1 is disabled - so it will not be
> fired on this statement)
>
> and finally
> ALTER TRIGGER trigger1 ENABLE;

Will try this tomorrow.

Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: archive, clean and search email
http://www.beatrixwillius.de
Fractals, 3d landscapes etc.



More information about the Valentina mailing list