Variable number of arguments

From: robewald(at)gmx(dot)net
To: pgsql-general(at)postgresql(dot)org
Subject: Variable number of arguments
Date: 2001-08-04 12:41:47
Message-ID: 3B6BED8B.41C01D64@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ü

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-08-04 15:14:48 Re: Referential Integrity thru Views
Previous Message Frank Joerdens 2001-08-04 11:43:22 dumping and reloading ONLY large objects