How to declare cursor if tablename is a variable? - Mailing list pgsql-sql

From hu js
Subject How to declare cursor if tablename is a variable?
Date
Msg-id BAY102-F38329B7028B182CFF13493F0730@phx.gbl
Whole thread Raw
Responses Re: How to declare cursor if tablename is a variable?  (Michael Fuhr <mike@fuhr.org>)
List pgsql-sql
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,yFROM 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  



pgsql-sql by date:

Previous
From: "Rodrigo De León"
Date:
Subject: Re: import CSV file
Next
From: "Sabin Coanda"
Date:
Subject: reindex database