Re: [GENERAL] How to loop through multi-dimentional array in PL/PGSQL - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: [GENERAL] How to loop through multi-dimentional array in PL/PGSQL
Date
Msg-id d10b22de-92f4-2828-d8e2-08d16f79abe6@iol.ie
Whole thread Raw
In response to [GENERAL] How to loop through multi-dimentional array in PL/PGSQL  (VENKTESH GUTTEDAR <venkteshguttedar@gmail.com>)
Responses Re: [GENERAL] How to loop through multi-dimentional array in PL/PGSQL
List pgsql-general
On 09/12/16 06:35, VENKTESH GUTTEDAR wrote:
> Hello,
>
>     Please help me in accessing multi-dimentional array in postgresql
> PL/PGSQL.
>
>     for i in array_lower(product_list, 1) .. array_upper(product_list, 1)
>     LOOP
>         product_list[i][0];
>     END LOOP;
>
>     Is the above code right?
>
>     Or is there any other way to access, i am getting null for
> product_list[i][0];

By default, PostgreSQL uses 1-based arrays (i.e. no [0] slot), so maybe
that's your problem.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie


pgsql-general by date:

Previous
From: Shreeyansh Dba
Date:
Subject: [GENERAL] Re: [ADMIN] Would like to below scenario is possible for gettingpage/block corruption
Next
From: Raymond O'Donnell
Date:
Subject: Re: [GENERAL] How to loop through multi-dimentional array in PL/PGSQL