From: Jie Liang <jliang@ipinc.com>
To: Sveinung Haslestad <sveinung.haslestad@swipnet.se>
Cc: pgsql-sql@postgresql.org
Subject: Re: Array as parameter in plpgSQL functions
Date: Wed, 31 Jan 2001 12:47:48 -0800 (PST)
Message-ID: <Pine.BSF.4.10.10101311240550.50465-100000@tidal.ipinc.com> (raw)
In-Reply-To: <002201c08bc4$9b8f8920$0d6e97d4@s243838>
e.g.
create function foo(_int4) returns int2 as'
declare
a _int4 alias for $1;
i int:=1;
begin
while a[i] loop
i:=i+1;
end loop;
return i-1;
end;
' language 'plpgsql';
you can call it by:
select foo('{1232131,12312321,3424234}');
you should get 3.
Jie LIANG
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.ipinc.com
On Wed, 31 Jan 2001, Sveinung Haslestad wrote:
> I need to pass an array to a function ( int4, variable number of elements) .
> How do i declare the parameter, and how can i tell the numer of recieved elements?
>
> Thanks
> /Sveinung
>
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jliang@ipinc.com, sveinung.haslestad@swipnet.se
Subject: Re: Array as parameter in plpgSQL functions
In-Reply-To: <Pine.BSF.4.10.10101311240550.50465-100000@tidal.ipinc.com>
References: <002201c08bc4$9b8f8920$0d6e97d4@s243838> <Pine.BSF.4.10.10101311240550.50465-100000@tidal.ipinc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox