Set return function with union all

Поиск
Список
Период
Сортировка
От Josué Maldonado
Тема Set return function with union all
Дата
Msg-id 41507C4C.1040408@lamundial.hn
обсуждение исходный текст
Список pgsql-general
Hello list,

is there a way to write in plpgsql the query that returns a set of this:

create view xxx as
(select '3ARR' as level,
dpe_stamp from detpa
where dpe_productfk=1
order by 2 desc limit 1)
union all
(select '2CAM' as level,
dpe_stamp from detpc
where dpe_productfk=1
order by 2 desc limit 1)
union all
(select '1PRO' as level,
dpe_stamp from detpp
where dpe_productfk=1
order by 2 desc limit 1)
order by 1 desc limit 1 ;

I already tried to use the same code in for in code block, I have a
custom type and a empty table for the return setof, any idea or suggestion?

Thanks in advance



--
Sinceramente,
Josué Maldonado.
"El sabio habla porque tiene algo que decir; el tonto, porque tiene que
decir algo" -- Platon

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Stored Procedures
Следующее
От: Christopher Petrilli
Дата:
Сообщение: Prioritizing queries