Re: How to declare cursor if tablename is a variable?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: How to declare cursor if tablename is a variable?
Дата
Msg-id 20070314140934.GA7086@winnie.fuhr.org
обсуждение исходный текст
Ответ на How to declare cursor if tablename is a variable?  ("hu js" <hu.bill2005@hotmail.com>)
Список pgsql-sql
On Wed, Mar 14, 2007 at 08:14:07AM +0000, hu js wrote:
> CREATE or replace function geo_polygon(tablename varchar) RETURNS 
> [...]
>    cur_obj CURSOR FOR SELECT mrc_xy_position FROM tablename;    
>    cur_point CURSOR FOR SELECT x,y FROM tablename where mrc_xy_position = 
> objectid;
> 
> Error if call the function. Neither to use “execute” . Who can solve 
> it? Thanks!

Are you sure you need to use cursors?  Can you not build the query
strings and use EXECUTE or "FOR variable IN EXECUTE query LOOP"?

-- 
Michael Fuhr


В списке pgsql-sql по дате отправления:

Предыдущее
От: Achilleas Mantzios
Дата:
Сообщение: Re: reindex database
Следующее
От: T E Schmitz
Дата:
Сообщение: Re: import CSV file