On Sun, Apr 13, 2008 at 01:07:26PM -0700, Bob Pawley wrote: > When I try it as a whole I get the message "control reached end of trigger > procedure without RETURN." I've re-indented the code to make it a bit more obvious what's going on in your old version: > DECLARE > pumpnumber integer; > BEGIN > SELECT count(*) INTO pumpnumber [...] > IF pumpnumber = 1 THEN > UPDATE p_id.devices [...] > ELSE > IF pumpnumber = 2 THEN > UPDATE p_id.devices [...] > END IF; > RETURN NULL; > END IF; > END; > > I have tried 'Return New' and 'Return Result' without luck, and if I leave > off either of the two 'End If ' statements the procedure returns an error. I think you're looking for either "ELSIF" or "ELSEIF", you've got white space between the ELSE and the IF which is introducing a new sub-expression. Either that, or move the RETURN after the final END IF. Sam