Re: Counting elements of an array

From: Renaud Tthonnart <thonnart(at)amwdb(dot)u-strasbg(dot)fr>
To: Christopher Sawtell <csawtell(at)xtra(dot)co(dot)nz>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Counting elements of an array
Date: 2001-03-01 12:18:08
Message-ID: 3A9E3E00.EFD0BF05@amwdb.u-strasbg.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christopher Sawtell wrote:

> On Thu, 01 Mar 2001 21:53, you wrote:
> > Good morning all,
> >
> > I would like to know how I can get the number of elements of an array.
>
> create function array_element_count(_int4) returns integer as '
> declare
> a alias for $1;
> i integer;
> begin
> i := 1;
> while a[i] loop
> i := i+1;
> end loop;
> return i-1;
> end;' language 'plpgsql' with(isstrict,iscachable);
>

Thanks a lot
Regards, Renaud THONNART

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paulo Parola 2001-03-01 12:40:08 Re: PostgreSQL 7.1 Linux Installation
Previous Message Michaël Fiey 2001-03-01 11:03:53 Count and Intersect