Hello Thomas,

thanks for your help. I wasn't aware that a delete-statement which deletes no rows inside a trigger fires a catch.
The SQL-Studio didn't even show a error.
Is there a special return-code for "nothing deleted"?

After executing the trigger with an empty catch-block, everything works fine.

Thanks,

Flo


Anhaus, Thomas schrieb:
Hi Florian,
I can't see any problem in this example.
The trace shows that your update statement updated many rows. For every updated 
row the trigger is fired. The first call of the trigger deleted all rows of 
schema1.trigger1, because there's no condition that filters any rows. The 
second trigger call therefore finds nothing to delete and stops with error 100, 
'unexpected error in trigger'.
The update statement was rolled back and error 100, 'unexpected error in 
trigger' is returned to the application.
This is the expected behavior.

Best Regards,
Thomas

-----Original Message-----
From: Florian Schmitz [mailto:[EMAIL PROTECTED] Sent: Dienstag, 14. Februar 2006 10:38
To: Anhaus, Thomas
Subject: Re: Problem creating Trigger

Hello Thomas,

see the attached trace.

Trigger-Definition

CREATE TRIGGER TRIGGER_UPDATE FOR TRIGGER2 AFTER UPDATE EXECUTE (
TRY
   DELETE FROM SCHEMA1.TRIGGER1;
CATCH
STOP($RC, 'unexpected error in trigger');
)



Tables

CREATE TABLE "SCHEMA1"."TRIGGER1"
(
        "ID"               Integer    NOT NULL    DEFAULT SERIAL (1),
        "BLAH"               Varchar (100) ASCII,
        PRIMARY KEY ("ID")
)

CREATE TABLE "SCHEMA1"."TRIGGER2"
(
        "ID"               Integer    NOT NULL    DEFAULT SERIAL (1),
        "BLAH"               Varchar (100) ASCII,
        PRIMARY KEY ("ID")
)


Statement

update trigger2 set blah = blah & '-1'



Thanks alot, Thomas.

Flo


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to