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

From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: "Foster, Stephen" <stephenlfoster(at)comcast(dot)net>
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:38:47
Message-ID: m2bqznh9m0.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

"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

In response to

Responses

Browse pgsql-general by date

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

Browse pgsql-sql by date

  From Date Subject
Next Message Foster, Stephen 2005-12-11 16:49:18 Re: [SQL] Looking for information on PostgreSQL Stored Procedures
Previous Message Foster, Stephen 2005-12-11 16:35:51 Re: [SQL] Looking for information on PostgreSQL Stored Procedures