From: | Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar> |
---|---|
To: | Anoop G <anoopmadavoor(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: how to returns set of records in PL/python |
Date: | 2008-04-07 13:04:31 |
Message-ID: | 47FA1BDF.8050407@fmed.uba.ar |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2008-04-07 13:36:38 | Re: Problem commit in function |
Previous Message | Gerardo Herzig | 2008-04-07 13:03:38 | Re: how to returns set of records in PL/python |