Cursor Error

From: La Chi <the_man(dot)inmee(at)yahoo(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Cursor Error
Date: 2012-04-03 09:23:24
Message-ID: 1333445004.77078.YahooMailNeo@web162202.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello every one

i have created this function to test cursors , but when i execute this funtion it give me this error , how can i fix this error

CREATE OR REPLACE FUNCTION foo(custid int) returns table(userid int) as
$BODY$

DECLARE rs cursor for Select customer_name from customer;

BEGIN
fetch forward 5 in rs;
 
END;
$BODY$
LANGUAGE plpgsql;

error--

ERROR:  syntax error at or near ";"
LINE 7:  fetch forward 5 in rs;
                              ^

********** Error **********

ERROR: syntax error at or near ";"
SQL state: 42601
Character: 172

Browse pgsql-sql by date

  From Date Subject
Next Message Jasen Betts 2012-04-03 10:49:23 Re: Wrong output from union
Previous Message La Chi 2012-04-03 07:44:20 How to write cursors