Re: [SQL] Looking for information on PostgreSQL Stored Procedures - Mailing list pgsql-general

From Tom Lane
Subject Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Date
Msg-id 17301.1134320658@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] Looking for information on PostgreSQL Stored Procedures  ("Foster, Stephen" <stephenlfoster@comcast.net>)
Responses Re: [SQL] Looking for information on PostgreSQL Stored Procedures
List pgsql-general
"Foster, Stephen" <stephenlfoster@comcast.net> 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

pgsql-general by date:

Previous
From: "Foster, Stephen"
Date:
Subject: Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Next
From: Michael Fuhr
Date:
Subject: Re: TSearch2: Auto identify document language?