Re: plpgsql returning resultset
От | Raymond O'Donnell |
---|---|
Тема | Re: plpgsql returning resultset |
Дата | |
Msg-id | 48BDB041.40306@iol.ie обсуждение исходный текст |
Ответ на | Re: plpgsql returning resultset (Thomas Finneid <tfinneid@student.matnat.uio.no>) |
Список | pgsql-general |
On 02/09/2008 22:19, Thomas Finneid wrote: > for num_list in select num > from table_part_num_list > where se=se_arg > loop > table_name := 'table_part_'|| num_list.num; > > select * into val_list > from table_name > where st=st_arg and tr=tr_arg; > > return next val_list; I think you need to build the query dynamically as a string, then execute it using EXECUTE: http://www.postgresql.org/docs/8.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN So something like this (I haven't tried it): loop execute 'select * into val_list from ' || 'table_part_' || num_list.num || ' where st = st_arg and tr = tr_arg'; return next val_list; end loop; Hopefully this will work. Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@iol.ie Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------
В списке pgsql-general по дате отправления: