Search Postgresql Archives

Re: Multidimentional array access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



VENKTESH GUTTEDAR <venkteshguttedar@xxxxxxxxx> writes:
>     I want to get the inner array in a multi dimentional array in a
> pl/pgsql procedure.

>     Eg : {{1,2,3,4,5,6,7},{11,22,33,44,55,66,77}}

>     for i in array_lower(Eg, 1) .. array_upper(Eg, 1)
>     LOOP
>         array_value = Eg[i]
>     END LOOP;

>     But Eg[i] is assigning null to array_value

I think you want

        array_value = Eg[i][array_lower(Eg, 2):array_upper(Eg, 2)]

As of 9.6 you could use the shorthand

        array_value = Eg[i][:]

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux