Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > how to returns ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 3396 of 3559
Post > Topic >>

how to returns set of records in PL/python

by anoopmadavoor@[EMAIL PROTECTED] ("Anoop G") Apr 7, 2008 at 06:17 PM

------=_Part_16329_22915949.1207572442520
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

------=_Part_16329_22915949.1207572442520
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi ,<br><br>&nbsp; Iam new to plpython,how can I return a&nbsp; recordset
from a plpython function?<br><br>&nbsp; Is there is any way give me an
example;<br><br>&nbsp; <br>plpgsql function
<br>--------------------------------<br><br>CREATE OR REPLACE FUNCTION
function_to_get_all_countries() RETURNS SETOF RECORD AS $BODY$<br>
DECLARE&nbsp;&nbsp;&nbsp; <br><br>&nbsp;&nbsp;&nbsp; r RECORD;&nbsp;&nbsp;
<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>BEGIN<br><br>&nbsp;&nbsp;&nbsp; FOR r IN
SELECT&nbsp; pk_bint_country_id,vchr_country FROM tbl_country
LOOP<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; RETURN NEXT
r;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END
LOOP;<br>&nbsp;&nbsp;&nbsp; RETURN;<br><br>END<br>$BODY$ LANGUAGE
&#39;plpgsql&#39;;<br>
<br><br><br><br>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)?<br><br>Thanks in advance<br><br>Anoop<br>

------=_Part_16329_22915949.1207572442520--
 




 3 Posts in Topic:
how to returns set of records in PL/python
anoopmadavoor@[EMAIL PROT  2008-04-07 18:17:22 
Re: how to returns set of records in PL/python
gherzig@[EMAIL PROTECTED]  2008-04-07 10:03:38 
Re: how to returns set of records in PL/python
gherzig@[EMAIL PROTECTED]  2008-04-07 10:04:31 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 22:12:46 CDT 2008.