plpgsql Cursor Mismatched Parentheses - Mailing list pgsql-general

From
Subject plpgsql Cursor Mismatched Parentheses
Date
Msg-id 200207120832.24c4@th00.opsion.fr
Whole thread Raw
Responses Re: plpgsql Cursor Mismatched Parentheses  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi!

I have never successfully used bounded parameterized
cursors. Error occurs when opening cursor. Please see
below and help!

Regards,

CN
===========================
CREATE FUNCTION test(SMALLINT,SMALLINT) RETURNS
BOOLEAN AS '
DECLARE
  y1 ALIAS FOR $1;
  m1 ALIAS FOR $2;

  o TEXT;
  y2 SMALLINT;
  m2 SMALLINT;

  c CURSOR (o TEXT,y1 SMALLINT,m1 SMALLINT,y2
SMALLINT,m2 SMALLINT) IS
  SELECT column1,column2 FROM table1 WHERE column9=o
AND column3 BETWEEN (SELECT column3 FROM table1 WHERE
column9=o AND column1=y1 AND column2=m1) AND (SELECT
column3 FROM table1 WHERE column9=o AND column1=y2
AND column2=m2) ORDER BY 1,2;

BEGIN
  o:=''xxx'';
  y2:=2002;
  m2=7;

  OPEN c(o,y1,m1,y2,m2);
  CLOSE c;

  RETURN TRUE;
END;' LANGUAGE 'plpgsql';
======================
database=# select test(2002,5);
NOTICE:  plpgsql: ERROR during compile of test near
line 17
ERROR:  mismatched parentheses

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com






pgsql-general by date:

Previous
From: Uros Gruber
Date:
Subject: What is better any why
Next
From: Thirumoorthy Bhuvneswari
Date:
Subject: Re: Query Speed!!!