Variable number of arguments - Mailing list pgsql-general

From robewald@gmx.net
Subject Variable number of arguments
Date
Msg-id 3B6BED8B.41C01D64@gmx.net
Whole thread Raw
List pgsql-general
Hi,

I'm wondering if there is any possibility of passing a variable number
of arguments to SQL or PLPGSQL functions.
I tried with arrays:

create function test(integer,varchar(20)[]) returns oid as '
declare
    narg ALIAS FOR $1;
    args ALIAS FOR $2;
begin
    FOR i IN 0..nargs-1 LOOP
        RAISE NOTICE ''args is %'', args[i];
                        ^^^^ <--this is obviously wrong
    END LOOP
END;
'
language 'plpgsql';

so the problem is accessing the values in an array.

If there is another approach to pass a variable number of arguments
please tell me.

Thanks

Robert ü

pgsql-general by date:

Previous
From: GH
Date:
Subject: Re: Index-speeds
Next
From: Frank Joerdens
Date:
Subject: dumping and reloading ONLY large objects