Re: Stored procedures vs Functions

From: Jeff Davis <list-pgsql-general(at)dynworks(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Stored procedures vs Functions
Date: 2001-12-22 01:36:03
Message-ID: 0GOQ007SW1WE5G@mta7.pltn13.pbi.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Some people return results in temp tables, 7.2 will allow cursors to be
> returned.

Oh great! I missed that addition. That should help out a lot.

I was trying it out and I had no problem creating the function. However, if I
have a function that returns a reference to a cursor, how would I got about
fetching form that cursor reference? I guess my question is: with SQL, how do
I turn the cursor reference into an actual cursor from which I may fetch
records? Below is what I tried:

jdavis=# begin;
BEGIN
jdavis=# select f1();
f1
--------------------
<unnamed cursor 5>
(1 row)

jdavis=# fetch 1 from f1();
ERROR: parser: parse error at or near "("
ERROR: parser: parse error at or near "("
jdavis=# fetch 1 from (select f1());
ERROR: parser: parse error at or near "("
ERROR: parser: parse error at or near "("
jdavis=# declare cursor2 cursor f1();
ERROR: parser: parse error at or near "f1"
ERROR: parser: parse error at or near "f1"
jdavis=# declare cursor2 cursor (select f1());
ERROR: parser: parse error at or near "("
ERROR: parser: parse error at or near "("
jdavis=#

Thanks!
Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2001-12-22 02:15:58 Re: Pl/Tcl problem
Previous Message Peter Pilsl 2001-12-21 23:22:45 Re: anyone knows about pam_pgsql ?