Search Postgresql Archives

Re: return setof : alternatives to holder table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In response to zhong ming wu :
> Hello List,
> 
> I have a plpgsql function returning a set of records.  The record is
> effectively a join of some tables.
> 
> For example, table a (column a1,column a2,column a3,column a4)
> 
> table b(column b1,column b2,column b4)
> 
> I am returning a set of (a2,a4,b2). What I do now is to create a empty table
> 
> foo(column a2,column a4,column b2)
> 
> then in my function I have
> 
> record r foo%rowtype
> 
> I'm not happy with this solution because this foo tables has to be kept around
> 
> Thanks for any better solution to this

You can create a aown typ or you can use IN/OUT-Parameters. I'm
prefering IN/OUT-Parameters, see here:

http://www.postgresonline.com/journal/archives/129-Use-of-OUT-and-INOUT-Parameters.html
http://bytes.com/topic/postgresql/answers/674690-output-parameters-functions


Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux