create a function with return type as a RECORD.

CREATE FUNCTION xyz() RETURNS record AS
$$
declare
 abc RECORD;
begin
 abc := (1, 2);
 return abc;
end;
$$
language plpgsql;

And execute the function in this fashion:

select a, b from xyz() as (a int, b int);

Do you like that ...  :-)

--Imad
www.EnterpriseDB.com


On 5/11/07, Gábriel Ákos <[EMAIL PROTECTED]> wrote:
On Fri, 11 May 2007 19:09:07 +0500
imad <[EMAIL PROTECTED]> wrote:

> You might be looking for PostgreSQL RECORD data type.

Thanks. Give me an example please. I saw the documentation already.

>
> --Imad
> www.EnterpriseDB.com
>
> On 5/11/07, Gábriel Ákos <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > How should I define a record type (there is no table with this
> > record type) programmatically in pl/pgsql?
> > I'd like to return a record with 3 string elements, 2 integers and 1
> > date.



--
Üdvözlettel,
Gábriel Ákos
-=E-Mail :[EMAIL PROTECTED]|Web:  http://www.i-logic.hu =-
-=Tel/fax:+3612367353            |Mobil:+36209278894          =-

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to