Re: plpgsql returning resultset

Поиск
Список
Период
Сортировка
От Thomas Finneid
Тема Re: plpgsql returning resultset
Дата
Msg-id 48BDA83E.4010603@ifi.uio.no
обсуждение исходный текст
Ответ на Re: plpgsql returning resultset  (Raymond O'Donnell <rod@iol.ie>)
Ответы Re: plpgsql returning resultset  (Thomas Finneid <tfinneid@student.matnat.uio.no>)
Re: plpgsql returning resultset  (Raymond O'Donnell <rod@iol.ie>)
Список pgsql-general
Raymond O'Donnell wrote:

> Can you show us more of your code?

I figured out how to make it work when using "for" instead of "with".

Here is the code and the error message. I couldnt find anything in the
documentation about "with" but I did find something about "for" which I
managed to make work. In any case here is the code for the "with" code:

create or replace function get_profile() returns setof tableA as
$$
declare
    val_list    tableA%rowtype;
begin

    with val_list in
      select * from tableA
    do
    loop
      return next val_list;
    end loop;

    return;
end;
$$ language 'plpgsql';


the error message is:

psql:functions.sql:116: ERROR:  syntax error at or near "with  $1"
LINE 1: with  $1  in select * from attribute_values_part_seq_1_ff_5 ...
         ^
QUERY:  with  $1  in select * from attribute_values_part_seq_1_ff_5 do
loop return next  $1
CONTEXT:  SQL statement in PL/PgSQL function "get_profile" near line 10



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

Предыдущее
От: "Kynn Jones"
Дата:
Сообщение: How to create a case-insensitive unique constraint?
Следующее
От: jose lawrence
Дата:
Сообщение: Conflict between MVCC and manual locking