Re: About a PL/pgSQL function

Поиск
Список
Период
Сортировка
Искать
От
Joel Burton
Тема
Re: About a PL/pgSQL function
Дата
Msg-id
Pine.LNX.4.30.0206061239340.12975-100000@temp.joelburton.com
Ответ на
About a PL/pgSQL function (Ferdinand Smit)
Список
Дерево обсуждения
About a PL/pgSQL function Ferdinand Smit <ferdinand@telegraafnet.nl>
Re: About a PL/pgSQL function Joel Burton <joel@joelburton.com>
On Thu, 6 Jun 2002, Ferdinand Smit wrote:

> When i create a function with a "static" table name, it works fine.
> EXECUTE does not allow SELECT INTO, so does anyone have an other solution?

Use:

DECLARE
  cursorname refcursor;
  varname int;
BEGIN
  OPEN cursorname FOR EXECUTE ''SELECT ... FROM '' || $1 || ...;
  FETCH cursorname INTO varname;
  CLOSE cursorname;
  RETURN varname;
END;


-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant

В списке pgsql-admin по дате отправления
От: Ferdinand Smit
Дата:
Сообщение: About a PL/pgSQL function
От: Oliver Elphick
Дата:
FAQ