From: hu js <hu.bill2005@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: How to declare cursor if tablename is a variable?
Date: Wed, 14 Mar 2007 08:14:07 +0000
Message-ID: <BAY102-F38329B7028B182CFF13493F0730@phx.gbl> (raw)
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
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: hu.bill2005@hotmail.com
Subject: Re: How to declare cursor if tablename is a variable?
In-Reply-To: <BAY102-F38329B7028B182CFF13493F0730@phx.gbl>
* 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