Subject | Can you guess the result of this query? :) |
---|---|
Author | Milan Babuskov |
Post date | 2006-08-12T08:56:12Z |
Who says we don't want FB to be strict with ambiguity:
create table new ( old INTEGER );
SET TERM ^ ;
CREATE TRIGGER NEW_BU1 FOR NEW ACTIVE BEFORE UPDATE POSITION 0 AS
BEGIN
select new.old from new where old.old = new.old
into new.old;
END^
SET TERM ; ^
INSERT INTO NEW (OLD) VALUES (1);
update new set old = 2;
select * from NEW;
Can you guess what this query would return? 1, 2 or NULL? ;)
P.S. This is only for fun. I doubt anyone would name their tables NEW or
OLD.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org
create table new ( old INTEGER );
SET TERM ^ ;
CREATE TRIGGER NEW_BU1 FOR NEW ACTIVE BEFORE UPDATE POSITION 0 AS
BEGIN
select new.old from new where old.old = new.old
into new.old;
END^
SET TERM ; ^
INSERT INTO NEW (OLD) VALUES (1);
update new set old = 2;
select * from NEW;
Can you guess what this query would return? 1, 2 or NULL? ;)
P.S. This is only for fun. I doubt anyone would name their tables NEW or
OLD.
--
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org