From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Vidya <sivaramanvidhya(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Cursor problem |
Date: | 2005-05-06 13:31:24 |
Message-ID: | 20050506133124.GA85924@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, May 06, 2005 at 05:58:11AM -0700, Vidya wrote:
>
> How do I create a cursor in psql .
>
> I have a function which opens a cursor .
> SampleDB=# create function reffunc(refcursor) returns refcursor as $$
> SampleDB$# begin
> SampleDB$# open $1 for select col from test;
> SampleDB$# return $1;
> SampleDB$# end;
> SampleDB$# $$ language sql;
> ERROR: syntax error at or near "open" at character 67
> LINE 3: open $1 for select col from test;
In this example the function's language should be plpgsql, not sql.
For more information about returning cursors from a PL/pgSQL function,
see the documentation:
http://www.postgresql.org/docs/8.0/interactive/plpgsql-cursors.html
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-05-06 13:37:49 | Re: Extracting date from timestamp |
Previous Message | Jeff - | 2005-05-06 13:01:58 | Re: Slony v. DBMirror |