Set return function with union all - Mailing list pgsql-general

From Josué Maldonado
Subject Set return function with union all
Date
Msg-id 41507C4C.1040408@lamundial.hn
Whole thread Raw
List 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 by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Stored Procedures
Next
From: Christopher Petrilli
Date:
Subject: Prioritizing queries