pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: La Chi <the_man.inmee@yahoo.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Cursor Error
Date: Tue, 3 Apr 2012 02:23:24 -0700 (PDT)
Message-ID: <1333445004.77078.YahooMailNeo@web162202.mail.bf1.yahoo.com> (raw)

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


Message-ID: <1333445004.77078.YahooMailNeo@web162202.mail.bf1.yahoo.com>
Permalink:  ../1333445004.77078.YahooMailNeo@web162202.mail.bf1.yahoo.com/
Also on:    postgresql.org/message-id/1333445004.77078.YahooMailNeo@web162202.mail.bf1.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: the_man.inmee@yahoo.com
  Subject: Re: Cursor Error
  In-Reply-To: <1333445004.77078.YahooMailNeo@web162202.mail.bf1.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox