List:General Discussion« Previous MessageNext Message »
From:Jeff Smelser Date:April 21 2006 6:40pm
Subject:Re: Loop Trigger
View as plain text  
On Wednesday 19 April 2006 11:10, Lucas Vendramin wrote:
> Hi all.
> I am creating a trigger that update the some table witch call it.
> Ex:
> create table t1 (
>  id int, name varchar(50), c int default 0, father int,
>  primary key(id),
>  index (father),
>  foreign key (father) references t1(id) on update restrict on delete
> restrict );
> create trigger tg_t1
> before update on t1
> for each row
> begin
>  update t1 set c=c+1 where father=NEW.id;
> end;

set NEW.c = NEW.c + 1;

or whatever. You dont update on a before trigger.. 

Jeff

Attachment: [application/pgp-signature]
Thread
Loop TriggerLucas Vendramin19 Apr
  • Re: Loop TriggerLucas Vendramin19 Apr
  • Re: Loop TriggerJeff Smelser21 Apr