i'm newbie sql triggers , getting esqliteexception on seems simple example. when try modify "membertag" column in existing row, exception "no such column: membertag". if drop trigger, exception goes away , row gets updated.
i'm using sqlite , i'm using "sqlite expert personal" app experimenting.
i have table:
create table [znode] ( [description] char not null, [membertag] char); and trigger:
create trigger [membertagtrigger] after update on [znode] each row when length(membertag)=0 begin update znode set membertag = null; end; my update experiment data this:
description membertag 1 x 2 (null) and when try change (null) "y" using sqlite expert personal, throws exception.
the problem in when clause: database not know membertag comes from, because there two possible rows, old one, , new one.
use either old.membertag or new.membertag.
(there problem: update change all rows in table, because forgot clause.)
Comments
Post a Comment