Search Postgresql Archives

Re: Plpgsql function with unknown number of args

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

 



You don't have to cast it as anything, just return a refcursor from your function.

Say you return a refcursor called return_cursor

select myfunction(your_in_array);
fetch all from return_cursor;

If you are calling from a development environment, you put the return value of the fuction (the refcursor name) into a variable, then dynamicly build the fetch
all statement from return value of the function. This must be done in the context of a transaction, i.e. both statements must must be executed in the same transaction.


The refcursors work really well and are very flexible.

Relyea, Mike wrote:

Thanks for the input. This looks very promising. I have one further
question. My SQL statement is going to pull data from more than one
table in a relatively complex query. How do I cast the RETURNS portion
of the function? Again, I can't find what I'm looking for in the docs.
I've included an actual sample SQL statement. I will only be changing
the first portion of the WHERE clause.





---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings

[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