Re: [GENERAL] Returning recordsets with functions

2004-09-23 Thread Stephan Szabo
On Thu, 23 Sep 2004, Robert Fitzpatrick wrote: > Can someone point me to some more information or perhaps show an example > of returning a recordset from a plpgsql function. I'd like to send an > argument or arguments to the function, do some queries to return a set > of records. I've done severa

Re: [GENERAL] Returning recordsets with functions

2004-09-23 Thread Joshua D. Drake
Hello, When using setOf functions you first create a type to call from: CREATE TYPE desc_results AS (entry_id INTEGER, headline TEXT, rank REAL); After creating the custom type you create a function that calls that type: CREATE OR REPLACE FUNCTION dresults(text) RETURNS SETOF desc_resul

Re: [GENERAL] Returning recordsets with functions

2004-09-23 Thread Robert Fitzpatrick
On Thu, 2004-09-23 at 18:28, Tim Penhey wrote: > Robert Fitzpatrick wrote: > > >Can someone point me to some more information or perhaps show an example > >of returning a recordset from a plpgsql function. I'd like to send an > >argument or arguments to the function, do some queries to return a s

Re: [GENERAL] Returning recordsets with functions

2004-09-23 Thread Tim Penhey
Robert Fitzpatrick wrote: Can someone point me to some more information or perhaps show an example of returning a recordset from a plpgsql function. I'd like to send an argument or arguments to the function, do some queries to return a set of records. I've done several functions that return one val

Re: [GENERAL] Returning recordsets with functions

2004-09-23 Thread Kevin Barnard
Use the return type of SETOF and user the RETURN NEXT for each record. If you are already returning a record that's half the battle. http://www.postgresql.org/docs/7.4/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING On Thu, 23 Sep 2004 11:26:15 -0400, Robert Fitzpatrick <[EM

[GENERAL] Returning recordsets with functions

2004-09-23 Thread Robert Fitzpatrick
Can someone point me to some more information or perhaps show an example of returning a recordset from a plpgsql function. I'd like to send an argument or arguments to the function, do some queries to return a set of records. I've done several functions that return one value of one type, but nothin