By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

using array data type

shoonya
100+
P: 161
i am using array as a data type in my db

Expand|Select|Wrap|Line Numbers
  1. ....
  2. (
  3. sequence integer[]
  4. ) ;
  5.  
and it stores a value
let {1,2,3,4,5}

now if i a selecting the array as
Expand|Select|Wrap|Line Numbers
  1. select sequence from foo where...
  2.  
then result which i get is not an array and i want it as an array
and i don't have to use
Expand|Select|Wrap|Line Numbers
  1. select sequence[index]
option

shoonya
Jun 5 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 534
... ... ...
now if i a selecting the array as
Expand|Select|Wrap|Line Numbers
  1. select sequence from foo where...
  2.  
then result which i get is not an array and i want it as an array
and i don't have to use
Expand|Select|Wrap|Line Numbers
  1. select sequence[index]
option
What you get back looks like a string representation of an array:
Expand|Select|Wrap|Line Numbers
  1. testdb=# SELECT sequence FROM tt2 WHERE x = 1;
  2.   sequence   
  3. -------------
  4.  {1,2,3,4,5}
  5. (1 row)
  6.  
If what you want is to initialize some local array variable to the result returned by the query, then it is up to you to do it, database has nothing to do with this, although you can obviously format the return value using array functions; for example you can remove the curly braces, change the default delimiter, etc.

You can find some useful information on arrays here:
Arrays
Array Functions and Operators

If this is not what you're trying to do, then clarify your question.
Jun 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.