"Foster, Stephen" <stephenlfoster@xxxxxxxxxxx> writes: > This is one of the simple ones that has me hung up. It currently errors > out on the first line. Why I have no idea. It looks right to me. You should show us the error message; most of us are not psychics. > CREATE FUNCTION sp_removedups() RETURNS void AS > $BODY$ > DECLARE lastname varchar(255); > fname varchar(255); > id bigint; > DECLARE NewListCursor CURSOR FOR > SELECT Name, id > FROM MailingList > ORDER BY Name; > OPEN NewListCursor; You're missing a BEGIN, and I'm not sure whether it's allowed to use the DECLARE keyword twice in the same block (the second instance is certainly unnecessary even if legal). regards, tom lane