Search Postgresql Archives

Re: Functions that return both Output Parameters and recordsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeremy Nix <Jeremy.Nix@xxxxxxxxxx> writes:
> I see what you're doing, but I'm not quite sure how to adapt it to what 
> I'm doing.  Here's simplified snippet of my code.  Can elaborate on how 
> I can return a recordset and the output parameters.?

I suppose what you need is something like

CREATE OR REPLACE FUNCTION Search (OUT TotalRecords int, OUT TotalPages int)
RETURNS SETOF record AS
$BODY$
     FOR myRecord IN
        SELECT cols FROM searchResults
    LOOP
        TotalRecords := myRecord.TotalRecords;
        TotalPages := myRecord.TotalPages;
        RETURN NEXT;
    END LOOP;

Anyway the point is that when you are using OUT parameters you do not
say anything in RETURN or RETURN NEXT.  Whatever you last assigned to
the parameter variables is what's returned.

			regards, tom lane


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux