MySQL Forums
Forum List  »  Triggers

stop trigger
Posted by: Aurel Pekarčík
Date: November 02, 2005 09:43AM

Hello, I need test a condition in before_trigger and then in some cases stop execution and return a application error code, like :

create trigger Docs_BD before delete on Docs for each row
begin
DECLARE aCnt integer;
SET aCnt = SELECT count(*) FROM Items where ID = Old.ID;
IF IfNull(aCnt,0) <> 0 THEN
SET @ErrMsg = 528; -- Application error -- Error528: Cant delete document with items;
BREAK ?
ERROR ?
-- HOW STOP THE TRIGGER ? ---
END IF;
end;

Any suggestion ?

Thanks.

Options: ReplyQuote


Subject
Views
Written By
Posted
stop trigger
3689
November 02, 2005 09:43AM
3560
November 04, 2005 09:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.