pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Douglas McNaught <doug@mcnaught.org>
To: Foster, Stephen <stephenlfoster@comcast.net>
Cc: 'Michael Fuhr' <mike@fuhr.org>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Date: Sun, 11 Dec 2005 11:38:47 -0500
Message-ID: <m2bqznh9m0.fsf@Douglas-McNaughts-Powerbook.local> (raw)
In-Reply-To: <000001c5fe70$f5e51330$2101a8c0@cfgod>
References: <000001c5fe70$f5e51330$2101a8c0@cfgod>

"Foster, Stephen" <stephenlfoster@comcast.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



view thread (10+ messages)  latest in thread

Message-ID: <m2bqznh9m0.fsf@Douglas-McNaughts-Powerbook.local>
Permalink:  ../m2bqznh9m0.fsf@Douglas-McNaughts-Powerbook.local/
Also on:    postgresql.org/message-id/m2bqznh9m0.fsf@Douglas-McNaughts-Powerbook.local

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: doug@mcnaught.org, stephenlfoster@comcast.net, mike@fuhr.org, pgsql-general@postgresql.org
  Subject: Re: [SQL] Looking for information on PostgreSQL Stored Procedures
  In-Reply-To: <m2bqznh9m0.fsf@Douglas-McNaughts-Powerbook.local>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox