Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Fri, 11 Mar 2005 17:46:49 -0500
  • Message-id: <5984.1110581209@sss.pgh.pa.us> <text/plain>

"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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group