Re: [SQL] Looking for information on PostgreSQL Stored Procedures

From: "Foster, Stephen" <stephenlfoster(at)comcast(dot)net>
To: "'Douglas McNaught'" <doug(at)mcnaught(dot)org>
Cc: "'Michael Fuhr'" <mike(at)fuhr(dot)org>, <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Date: 2005-12-11 16:49:18
Message-ID: 000101c5fe72$d6a71c50$2101a8c0@cfgod
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Ok, I tried it in that I'm still getting errors. Happy to do so but
well is my errors?

-----Original Message-----
From: Douglas McNaught [mailto:doug(at)mcnaught(dot)org]
Sent: Sunday, December 11, 2005 10:39 AM
To: Foster, Stephen
Cc: 'Michael Fuhr'; pgsql-general(at)postgresql(dot)org;
pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] [GENERAL] Looking for information on PostgreSQL
Stored Procedures

"Foster, Stephen" <stephenlfoster(at)comcast(dot)net> writes:

> WHILE (--Lost on variable name for end of query; EmptyQueryResponse <>
> 0? --)
> BEGIN
> IF LastName = fname THEN
> DELETE FROM MailingList WHERE id = id;
> END IF;
> LastName := fname;
> FETCH NEXT FROM NewListCursor INTO fname, id;
> END;
> CLOSE NewListCursor;
> $BODY$
> LANGUAGE 'sql' VOLATILE;

You can't do any looping or other control structures in an SQL
function. Use PL/pgSQL instead.

-Doug

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/197 - Release Date:
12/9/2005

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/197 - Release Date:
12/9/2005

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-12-11 17:04:18 Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Previous Message Tom Lane 2005-12-11 16:44:39 Re: PL/pgSQL : notion of deferred execution

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-12-11 17:04:18 Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Previous Message Douglas McNaught 2005-12-11 16:38:47 Re: [SQL] Looking for information on PostgreSQL Stored Procedures