Re: Update Trigger in IDS 7.3
Posted in 1998
Topics: Triggers, Constraints & Referential Integrity, Versions, Editions & End-of-Life
If one of the value being updates is null the condition evaluates to NULL
itself.
Please try
create trigger upd_tab1 update of col2 on tab1
referencing old as pre new as post
for each row when ( (pre.col2 is null and post.col2 is not null) or
(pre.col2 is not null and post.col2 is null)
or (pre.col2!=post.col2)) ) (insert into tab2 (col1,col2) values
('GOT' ,'IT!' ));
Madan Mashalkar <madan@infogain.com> wrote in article
<6tsdvm$kqe$1@news.xmission.com>...
>
>
> Hi,
>
> There is a simple trigger:
> create trigger upd_tab1 update of col2 on tab1
> referencing old as pre new as post
> for each row when (pre.col2 != post.col2)
> (insert into tab2 (col1,col2) values ('GOT' ,'IT!' ));>
> Then inserting and updating a row in an empty table tab1:
>
> insert into tab1 (col1,col2) values('TEST',null);
> update tab1 set col2 = 'NEW' where col1 = 'TEST';>
> No rows are inserted in tab2.
> (Interesting, if either the pre or the post value is NULL,
> no rows are inserted in tab2)
>
> The manual states that if the 'when' evaluates to false/unknown, then
> the action(insert) will not be done.
>
> So, does (pre.col2 != post.col2) evaluate to unknown ???
> If yes, then is it expected behaviour ?
>