Setting variables equal to elements from an Array

From: cdecarlo <cdecarlo(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Setting variables equal to elements from an Array
Date: 2008-01-05 14:10:31
Message-ID: 0cd65a60-500c-4a74-a78a-4b3ac816b0b8@m77g2000hsc.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Clodoaldo 2008-01-05 14:34:27 Re: Performance problem. Could it be related to 8.3-beta4?
Previous Message Joana G. Malaverri 2008-01-05 13:56:50 PostgreSQL - XML