Re: Counting elements of an array - Mailing list pgsql-general

From Renaud Tthonnart
Subject Re: Counting elements of an array
Date
Msg-id 3A9E3E00.EFD0BF05@amwdb.u-strasbg.fr
Whole thread Raw
In response to Counting elements of an array  (Renaud Tthonnart <thonnart@amwdb.u-strasbg.fr>)
List 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


pgsql-general by date:

Previous
From: Michaël Fiey
Date:
Subject: Count and Intersect
Next
From: "Paulo Parola"
Date:
Subject: Re: PostgreSQL 7.1 Linux Installation