Skip site navigation (1) Skip section navigation (2)

Re: Return data from function

From: Robert Treat <robert(at)omniti(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Cc: "Alexander B(dot)" <burbello3000(at)yahoo(dot)com(dot)br>
Subject: Re: Return data from function
Date: 2007-04-18 02:02:22
Message-ID: 200704172202.22873.robert@omniti.com (view raw or flat)
Thread:
Lists: pgsql-admin
On Tuesday 17 April 2007 15:17, Alexander B. wrote:
> Hello,
>
> I need to create a function that find data over 3 tables, merge and
> return data.
> With example can be specified more clearly:
>
> 1.1 Find all addresses code;
> 1.2 For each addresses code, get address, complement and city on the
> first table;
> 1.3 For each addresses code, get address, complement and city on the
> second table;
> 1.4 Merge result from first and second tables and return to the function;
>
> I would like to do not using cursor.
> Do you have any ideas how to implement?
>

I'm not convinced you can't do this from plain sql, but if you're sure a 
function is the way to go, see the docs on set returning functions:
http://www.postgresql.org/docs/current/static/xfunc-sql.html#XFUNC-SQL-TABLE-FUNCTIONS

-- 
Robert Treat
Database Architect
http://www.omniti.com/

In response to

pgsql-admin by date

Next:From: adeyDate: 2007-04-18 04:18:02
Subject: Re: Checking a size of a given database
Previous:From: Robert TreatDate: 2007-04-18 02:01:48
Subject: Re: Checking a size of a given database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group