pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: Anoop G <anoopmadavoor@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to returns set of records in PL/python
Date: Mon, 07 Apr 2008 10:04:31 -0300
Message-ID: <47FA1BDF.8050407@fmed.uba.ar> (raw)
In-Reply-To: <1a027d210804070547w3117f195qa279b487b896674d@mail.gmail.com>
References: <1a027d210804070547w3117f195qa279b487b896674d@mail.gmail.com>

Anoop G wrote:

>Hi ,
>
>  Iam new to plpython,how can I return a  recordset from a plpython
>function?
>
>  Is there is any way give me an example;
>
>
>plpgsql function
>--------------------------------
>
>CREATE OR REPLACE FUNCTION function_to_get_all_countries() RETURNS SETOF
>RECORD AS $BODY$
>DECLARE
>
>    r RECORD;
>
>BEGIN
>
>    FOR r IN SELECT  pk_bint_country_id,vchr_country FROM tbl_country LOOP
>        RETURN NEXT r;
>        END LOOP;
>    RETURN;
>
>END
>$BODY$ LANGUAGE 'plpgsql';
>
>
>
>
>How i can get the same result using plpythonu and how I can call the
>function (is there any user defined type required like in plpgsql)?
>
>Thanks in advance
>
>Anoop
>
>  
>
Forgot to mention that postgres home page has some info about plpython.
http://www.postgresql.org/docs/8.3/static/plpython-funcs.html

Cya.
Gerardo



view thread (3+ messages)

Message-ID: <47FA1BDF.8050407@fmed.uba.ar>
Permalink:  ../47FA1BDF.8050407@fmed.uba.ar/
Also on:    postgresql.org/message-id/47FA1BDF.8050407@fmed.uba.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gherzig@fmed.uba.ar, anoopmadavoor@gmail.com
  Subject: Re: how to returns set of records in PL/python
  In-Reply-To: <47FA1BDF.8050407@fmed.uba.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox