I have a trigger (see below) written for SQL Server, using a CTE and a merge statement.
Would it be possible to write the same for DB2?
I'm having difficulties in writing it could you please help?
Thanks a lot
CREATE TRIGGER update_items on RESULTS
select Id, ItemID, Result
Result <> '' and
Id in (2,4,5)
) merge into COMPUTERS using props
on props.Id = COMPUTERS.ComputerID
when matched then
update set IsReady = case when props.Id = 2 and LTRIM(RTRIM(props.Result)) = 'Yes' then 1 else IsReady end,
OriginID = case when props.Id = 4 then props.Id else OriginID end;