Set return function with union all

Started by Josué Maldonadoover 21 years ago1 messagesgeneral
Jump to latest
#1Josué Maldonado
josue@lamundial.hn

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