X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 45D879DCBC2; Sun, 11 Dec 2005 13:04:23 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95551-08; Sun, 11 Dec 2005 13:04:21 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id EB9219DCBAA; Sun, 11 Dec 2005 13:04:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jBBH4IPt017302; Sun, 11 Dec 2005 12:04:18 -0500 (EST) To: "Foster, Stephen" cc: "'Michael Fuhr'" , pgsql-general@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [SQL] Looking for information on PostgreSQL Stored Procedures In-reply-to: <000001c5fe70$f5e51330$2101a8c0@cfgod> References: <000001c5fe70$f5e51330$2101a8c0@cfgod> Comments: In-reply-to "Foster, Stephen" message dated "Sun, 11 Dec 2005 10:35:51 -0600" Date: Sun, 11 Dec 2005 12:04:18 -0500 Message-ID: <17301.1134320658@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.003 required=5 tests=[AWL=0.003] X-Spam-Score: 0.003 X-Spam-Level: X-Archive-Number: 200512/534 X-Sequence-Number: 88097 "Foster, Stephen" 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