Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E19489FB6A4 for ; Wed, 14 Mar 2007 05:14:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 10563-01 for ; Wed, 14 Mar 2007 05:14:12 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from bay0-omc2-s27.bay0.hotmail.com (bay0-omc2-s27.bay0.hotmail.com [65.54.246.163]) by postgresql.org (Postfix) with ESMTP id 5DBFE9FB720 for ; Wed, 14 Mar 2007 05:14:12 -0300 (ADT) Received: from hotmail.com ([64.4.61.48]) by bay0-omc2-s27.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Wed, 14 Mar 2007 01:14:10 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 14 Mar 2007 01:14:10 -0700 Message-ID: Received: from 64.4.61.244 by by102fd.bay102.hotmail.msn.com with HTTP; Wed, 14 Mar 2007 08:14:07 GMT X-Originating-IP: [203.125.54.38] X-Originating-Email: [hu.bill2005@hotmail.com] X-Sender: hu.bill2005@hotmail.com From: "hu js" To: pgsql-sql@postgresql.org Subject: How to declare cursor if tablename is a variable? Date: Wed, 14 Mar 2007 08:14:07 +0000 Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312; format=flowed X-OriginalArrivalTime: 14 Mar 2007 08:14:10.0837 (UTC) FILETIME=[BEB4AC50:01C76610] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.908 tagged_above=0 required=5 tests=BAYES_50, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, MSGID_FROM_MTA_HEADER, SPF_PASS X-Spam-Level: * X-Archive-Number: 200703/191 X-Sequence-Number: 27829 See this: “CREATE or replace function geo_polygon(tablename varchar) RETURNS integer AS $$ DECLARE objectid varchar; tab varchar; x1 float; y1 float; obj_num integer; point_num integer; polygonstr varchar; cur_obj CURSOR FOR SELECT mrc_xy_position FROM tablename; cur_point CURSOR FOR SELECT x,y FROM tablename where mrc_xy_position = objectid; BEGIN …….“ Error if call the function. Neither to use “execute” . Who can solve it? Thanks! _________________________________________________________________ 享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com