[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    Re: [SQL] scroll cursor bug or me?
From:       "Sim Zacks" <sim () compulab ! co ! il>
Date:       2005-06-22 8:22:04
Message-ID: d9b3nd$1b9s$1 () news ! hub ! org
[Download RAW message or body]

It seems to me that scroll cursors are not valid in plpgsql.
The following query in PGAdmin works. run one line at a time.

begin work;

declare bob scroll cursor for select * from testtbl;

fetch forward 5 from bob;
fetch prior  from bob;

rollback work;



"Larry Morroni" <lam170@yahoo.com> wrote in message
news:QrSdnW6Ltdl8jyXfRVn-vQ@comcast.com...
> Hi, I am hitting an issue when using SCROLL CURSORS.
>
> -->My Setup:
> PostgreSQL 8.0.3 on Windows XP Pro SP2
>
>
> -->My Test Function:
> CREATE OR REPLACE FUNCTION TestFunction () RETURNS varchar(50) AS
> $$
> DECLARE CursorProductGroups SCROLL CURSOR FOR SELECT * FROM TEST_TABLE;
> BEGIN
>          RETURN NULL;
> END;
> $$
> LANGUAGE plpgsql
> ;
>
> -->psql spits back the following:
>
> STORE_PHYSICAL_A=# \i test.sql
> psql:test.sql:9: ERROR:  syntax error at or near "CURSOR"
> CONTEXT:  invalid type name "SCROLL CURSOR FOR SELECT * FROM TEST_TABLE"
> compile of PL/pgSQL function "testfunction" near line 1
> STORE_PHYSICAL_A=#
>
> This seems like a bug to me because my demo looks
> just like the examples given in the PostgreSQL documentation.  ie...
>
> -- BEGIN POSTGRES DOC EXAMPLE
> BEGIN WORK;
> DECLARE liahona SCROLL CURSOR FOR SELECT * FROM films;
> FETCH FORWARD 5 FROM liahona;
> CLOSE liahona;
> COMMIT WORK;
> -- END POSTGRES DOC EXAMPLE
>
> Any ideas?
>
> Larry Morroni




---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic