Re: Acccessing individual array elements form plpgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Celia McInnis" <celia(at)drmath(dot)ca>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Acccessing individual array elements form plpgsql
Date: 2005-03-11 22:46:49
Message-ID: 5984.1110581209@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Celia McInnis" <celia(at)drmath(dot)ca> writes:
> but how do I access members of this array individually??? I'd love it if
> direction[1] would pull out the 2nd or 1st element so that I could use it in
> the selects which my procedure is forming, but I get syntax errors when I try
> to reference the array element in such a way. For example:

> RAISE NOTICE '%',direction[1];
> ERROR: syntax error at or near "[" at character ####

The RAISE statement is pretty limited: it won't take a general
expression as an argument, only a bare variable name. But you should be
able to subscript direction in other contexts. If you really need to
put out a notice using this value, assign it to a temporary variable ...

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Celia McInnis 2005-03-11 23:27:22 Re: Acccessing individual array elements form plpgsql
Previous Message Celia McInnis 2005-03-11 22:41:10 Acccessing individual array elements form plpgsql