Setting variables equal to elements from an Array

Поиск
Список
Период
Сортировка
От cdecarlo
Тема Setting variables equal to elements from an Array
Дата
Msg-id 0cd65a60-500c-4a74-a78a-4b3ac816b0b8@m77g2000hsc.googlegroups.com
обсуждение исходный текст
Ответы Re: Setting variables equal to elements from an Array  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello,

I'm new to pl/pgsql and postgres and I need some help with a part of
my function.  In the function I loop through a multidemensional array
( [n][3] ), once, while inside the loop, I find the index I want to
work with I would like to set a separate variable equal to the element
in the array at that index ( newVar = array[i] ).

I tried to accomplish this with the following bit of code:

newVar := mnArray[i]

but for some reason that assigned NULL to newVar, then I tried:

newVar := mnArray[i][3:3]

and that appeared to have worked, however when I try to index an
element in the newVar array it produces NULL.  I'm wondering two
things, first, does mnArray[i][3:3] return an array or a string
representation of the element at that index (which in this case is an
array)? and secondly, how do I do what I want to do (make newVar an
array)?

Thanks,

Colin

В списке pgsql-general по дате отправления:

Предыдущее
От: rihad
Дата:
Сообщение: Re: need to dump/restore data for 8.3beta2 -> 8.3RC1 upgrade?
Следующее
От: Lew
Дата:
Сообщение: Re: Need efficient way to do comparison with NULL as an option