Re: Return cursor

Поиск
Список
Период
Сортировка
От alla@sergey.com (Alla)
Тема Re: Return cursor
Дата
Msg-id 9275d56e.0105250632.667d5bed@posting.google.com
обсуждение исходный текст
Ответ на Re: Return cursor  (Alexander Dederer <dederer@spb.cityline.ru>)
Список pgsql-general
"Sergey E. Volkov" <sve@raiden.bancorp.ru> wrote in message news:<9ej088$ulc$1@news.tht.net>...
> If you are planing  to use ecpg :
>
> exec sql declare cuserbase cursor for
>      select column1, column2, column3 from my_table order by 1;
> exec sql open cuserbase;

Thanks, but this is exactly what I am trying to avoid - having select statements
in client applications.

I want to write stored procedures with all the logic and give the names
and parameters to my developers, so they could just do the fetch.

In this case, I'll be free to change any underlying logic - tables' names,
column names, select statements itself, add some extra logic to the
where clause etc

Alla

P.S. If you are curious, I found something like this:

create function edf_load_user_base()
returns setof edv_user_base as '
select * from edv_user_base
where ... (complex where clause)'
language 'sql';

And then call it as following:

select column1(edf_load_user_base()), column2(edf_load_user_base()) etc

Does anybody know how I can return setof of something other than table%rowtype,
i.e. can I define a record type my_record and do something like this:

create function edf_load_user_base()
returns setof my_record
....

Sorry to be a pain, but I have a deadline to do the migration and
not enough time to do my research :-((

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

Предыдущее
От: Yann Ramin
Дата:
Сообщение: Re: database size including indexes
Следующее
От: "Arve Fahlvik"
Дата:
Сообщение: Problems with backup