From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Koukoulis <pkoukoulis(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: cursor declare |
Date: | 2017-09-15 19:52:54 |
Message-ID: | 1136.1505505174@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Peter Koukoulis <pkoukoulis(at)gmail(dot)com> writes:
> This is my first cursor attempt:
> according to docs
> DECLARE
> curs1 refcursor;
> curs2 CURSOR FOR SELECT * FROM tenk1;
> curs3 CURSOR (key integer) FOR SELECT * FROM tenk1 WHERE unique1 = key;
> this should work, but getting error:
> ft_node=# declare cur_test1 CURSOR (key integer) for select * from test1
> where x=key;
> ERROR: syntax error at or near "("
> LINE 1: declare cur_test1 CURSOR (key integer) for select * from tes...
It looks like you're trying to use the plpgsql syntax for a cursor
variable as part of a DECLARE CURSOR SQL-level command. They're not
the same thing at all. In particular, there isn't any concept of
parameters in the SQL DECLARE CURSOR command.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Thelonius Buddha | 2017-09-15 19:56:21 | New interface to PG from Chapel? |
Previous Message | Rafal Pietrak | 2017-09-15 19:39:24 | Re: looking for a globally unique row ID |