Re: [GENERAL] Plpgsql function with unknown number of args

2005-04-18 Thread Tony Caduto
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 refcu

Re: [GENERAL] Plpgsql function with unknown number of args

2005-04-18 Thread Tom Lane
"Relyea, Mike" <[EMAIL PROTECTED]> writes: > 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? In current releases

Re: [GENERAL] Plpgsql function with unknown number of args

2005-04-18 Thread Relyea, Mike
) INNER JOIN "tblBlockAC" ON "Targets"."TargetID" = "tblBlockAC"."TargetID" WHERE (("PrintSamples"."MachineID" = '2167' OR "PrintSamples"."MachineID" = '2168' OR "PrintSample

Re: [GENERAL] Plpgsql function with unknown number of args

2005-04-18 Thread Tony Caduto
you coud pass in criteria as a delimted string, then pull out each arg something like this CREATE or REPLACE FUNCTION test_func( varchar) RETURNS pg_catalog.void AS $BODY$ DECLARE IN_ARRAY text[] ; arg1 varchar; arg2 varchar; arg3 varchar begin IN_ARRAY = string_to_array($1,'~^~'); arg1= IN_ARR

Re: [GENERAL] Plpgsql function with unknown number of args

2005-04-18 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Relyea, Mike" <[EMAIL PROTECTED]> writes: > I need to create my very first function. I'm using 8.0.2 and I need a > function that I can call (from my client app) with an unknown number of > criteria for a select query. The function will then return the results >

[GENERAL] Plpgsql function with unknown number of args

2005-04-18 Thread Relyea, Mike
I need to create my very first function. I'm using 8.0.2 and I need a function that I can call (from my client app) with an unknown number of criteria for a select query. The function will then return the results of the query. In my mind, it would go something like what I've outlined below. I r