Re: [GENERAL] Variable Substitution for table name

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: [GENERAL] Variable Substitution for table name
Дата
Msg-id 20020316160551.W74854-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Variable Substitution for table name  ("Samuel J. Sutjiono" <ssutjiono@wc-group.com>)
Список pgsql-sql
On Sat, 16 Mar 2002, Samuel J. Sutjiono wrote:

> Hello all,
>
> Does anybody know whether I can do variable substitution in PostgreSQL function ???

In plpgsql you can usually use EXECUTE to build a query string
and run it in place of the plain query, so something like

EXECUTE ''SELECT DeptdID, VendorName
 from '' || NewView || '' where DeptId=iDeptID''

in place of the select query.

>
> create function Test(text) returns text as '
> DECLARE
>   NewView ALIAS for $1;
>
> BEGIN
>
>  For rec_set IN SELECT DeptdID, VendorName
>  from NewView where  (DeptID = iDeptID)
>
> I appreciate any help very much.
>
>


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

Предыдущее
От: "Dan Langille"
Дата:
Сообщение: Re: why the big difference on this explain analyze?
Следующее
От: "Dan Langille"
Дата:
Сообщение: Re: why the big difference on this explain analyze?