473,749 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retrieve column array values

38 New Member
i have a column which contains arrays of variable length. for example one array contains 5 elements, another contains 2 elements, another array 10 elements.
i have 500 records in this column

i want to select all elements of an array then below all elements of another array and so on in a normal column. this is very urgent if some body can help plz....

infact this operation is reverse to insert values from a column into array.

thnx n regards
Jan 20 '07 #1
1 4457
MarkD
4 New Member
Do you mean essentially exploding the results into individual rows:

source:

{1,2,3} , {3,4,5,6,7,8} , {9,a,b,c}

desired result :
1
2
3
3
4
5
6
7
8
9
a
b
c

If so you can use an explode array stored procedure like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. CREATE OR REPLACE FUNCTION explode_array(in_array anyarray)
  3.   RETURNS SETOF anyelement AS
  4. $BODY$
  5.     SELECT ($1)[s] FROM generate_series(1, array_upper($1, 1)) AS s;
  6. $BODY$
  7.   LANGUAGE 'sql' IMMUTABLE;
  8. ALTER FUNCTION explode_array(in_array anyarray) OWNER TO postgres;
  9.  
and call

SELECT explode_array( col1 || col2 || col3 )
FROM Table blah

where col1, col2 and col3 are the arrays in your table. The || operator joins the arrays together first.

Thanks.
Feb 9 '07 #2

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

Similar topics

2
1785
by: HairlipDog58 | last post by:
I have a component that implements a property called obj of type object. The intent is that a user can pass in any value or array of values and I will be able to retrieve the values. If the user creates an array and passes it to the obj property, I'm having trouble figuring out an easy way to obtain the values in the array without using a conditional for each type. Is there a built-in method to obtain the values of an array assigned...
1
5062
by: Prasad Karunakaran | last post by:
I am using the C# DirectoryEntry class to retrieve the Properties of an user object in the Active Directory. I need to get the First Name and Last Name as properties. I know it is not supported with the ADSI NT Provider and only supported in the LDAP Provider. So given an UserId (UID) how can I read the First Name and Last Name using LDAP Provider. If anybody can help me with a C# sample code it would of great help. Thanks in advance.
3
3799
by: Tony Marston | last post by:
I am using PHP 4.4.4 with Oracle 10g Express Edition on Windows XP. I am trying to emulate in Oracle the SET datatype in MySQL and the ARRAY datatype in PostgreSQL I have the created a user-defined datatype as follows: CREATE OR REPLACE TYPE t_fav_food IS VARRAY(10) OF NUMBER(2);
7
21479
gchq
by: gchq | last post by:
Hi there Here is the situation - a table is built dynamically with values in the cells I need to retrieve and enter into a database. I have found a way of getting values using JavaScript, but of course with the table being dynamic I have no idea how many rows it will contain. One way is using the TableID.rows.count and then building if statements based on the value - but that is going to be an awfull lot of coding...... So the question is -...
9
4793
by: Mel | last post by:
I have 10 columns total. 3 of them are invisible. The rest are read- only BoundFields, 3 of which are editable fields using TemplateFields. Upon editing, I want to validate what the user enters against one of those invisible columns. How do I accomplish this? The code below that I attempted just returns an empty string when I try to retrieve the invisible column data: gvParts.Rows(e.RowIndex).Cells(8).Text
14
6201
by: zionlion | last post by:
I want to only retrieve the values of one column in mysql and use these values to plot a graph. I know how to echo these values. However, I am unable to write them seperately. Let's say I have a table called cars. It has a column for car vin and a column for brand and a column for price. I just want to retrieve the column for the price and use these numbers to plot a bar graph. So the X-axis shows bar 1, 2, 3 ... and the bar length shows the...
2
1449
by: zionlion | last post by:
PHP code How can I retrieve elements of an array in numeric format? Look at this code: $query = "SELECT price FROM $tbl_name"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_row($result)) {
2
3700
by: chirag1989 | last post by:
i have created an arry of text box now i want to retrieve the values of each text box so as to insert them in data base can anyone help how can i retrieve the values of array of textbox and store it in other array Code Of creating text box array <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <form action="ext1.asp" method="post"> <%for i=0 to 4 response.write "<input type=text name=txt id="&i&" ><br>"
4
6500
by: TechnoAtif | last post by:
Hi ALL I have entered some array values using checkboxes into mysql database through a form. Next iam creating a searchpage where all those cateogories inserted through checkboxes has to be retrieved using list/menu box. When i check only a single checkbox to insert the checked category ,selecting that category through list box gives out the entire data of the user corresponding to that category. However when i check multiple checkboxes and...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9254
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.