knowledge-database (beta)

Current group: pgsql.hackers

Re: can plpgsql returns more flexibe value ?

Re: can plpgsql returns more flexibe value ?  
Arnold.Zhu
 Re: can plpgsql returns more flexibe value ?  
Kris Jurka
From:Arnold.Zhu
Subject:Re: can plpgsql returns more flexibe value ?
Date:Sat, 22 Jan 2005 09:53:37 +0800
Hello, Christopher Kings-Lynne


>Yeah, you just make your function return 'SETOF record' and specify the
>types when you do the select:
>
>select * from func() as (a int, b text);
>
>Chris
>

This is not a good idea when I use C# to program, I want to Fill the resultset
directly into Dataset, this method will should use more sql to get data,
it lose function's convenience like stored procedure.

Thanks & Regards!

Arnold.Zhu
2005-01-22




---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
From:Kris Jurka
Subject:Re: can plpgsql returns more flexibe value ?
Date:Fri, 21 Jan 2005 22:24:00 -0500 (EST)


On Sat, 22 Jan 2005, Arnold.Zhu wrote:

> >Yeah, you just make your function return 'SETOF record' and specify the
> >types when you do the select:
> >
> >select * from func() as (a int, b text);
> >
>
> This is not a good idea when I use C# to program, I want to Fill the resultset
> directly into Dataset, this method will should use more sql to get data,
> it lose function's convenience like stored procedure.
>

Perhaps you should look into the refcursor type, which will allow you to
return anything you want without specifying it. You can't do things like
a join between to refcursor outputs, but it does allow for more return
flexibility.

Kris Jurka


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

Copyright © 2006 knowledge-database   -   All rights reserved