"Rhys A.D. Stewart" <rhys.stewart@xxxxxxxxx> writes: > I must be very tired, very hungry or both. I'm getting a syntax error in > the last line with the 'END;' But am clearly not seeing what the error is. > Any help would be appreciated. I think you need to change ELSE IF to ELSEIF. As written you need two END IF lines to match the two independent IFs. I wonder whether we could get plpgsql's parser to be more helpful about END-matching errors ... they're certainly easy ones to make. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general