Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id B03081FA8BD for ; Thu, 12 Apr 2012 05:55:25 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SIFoI-0002Ho-7r for pgsql-bugs@postgresql.org; Thu, 12 Apr 2012 08:55:24 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SIFo5-0005Pf-2o for pgsql-bugs@postgresql.org; Thu, 12 Apr 2012 08:55:09 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1SIFo4-00025a-H3 for pgsql-bugs@postgresql.org; Thu, 12 Apr 2012 08:55:08 +0000 Date: Thu, 12 Apr 2012 08:55:08 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6583: for loop cursor To: pgsql-bugs@postgresql.org From: biju.george@ust-global.com X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201204/71 X-Sequence-Number: 32822 The following bug has been logged on the website: Bug reference: 6583 Logged by: Biju George Email address: biju.george@ust-global.com PostgreSQL version: 8.4.0 Operating system: Linux Description: = Just this simple code throws below error -- CREATE OR REPLACE FUNCTION my_temp_func(v_acc_type integer) RETURNS void AS $BODY$ declare v_cur cursor (acc_num integer) is select pid from public.my_trade_table where acc_type =3D acc_num; begin for record_var in v_cur(v_acc_type) loop raise notice 'ID is %',record_var.id; end loop; end; $BODY$ LANGUAGE plpgsql; ------------Error--------------- ERROR: syntax error at or near "$1" LINE 1: $1 ( $2 ) ^ QUERY: $1 ( $2 ) CONTEXT: SQL statement in PL/PgSQL function "my_temp_func" near line 4 ********** Error ********** ERROR: syntax error at or near "$1" SQL state: 42601 Context: SQL statement in PL/PgSQL function "my_temp_func" near line 4