Hi Guys. If i run a simple query that returns 5 records each with a column as follows : select * from tableName ..... returns: row1 = aaa row2 = bbb row3 = ccc row4 = ddd row5 = eee Question : How do i get just a String from the resultset .Which means concatenating all the records on the database and returning just one String object from my resultset. Hence desired result: String x =aaa + bbb + ccc + ddd + eee ; All codes and references will be appreciated NOTE : my actual logic is returning 1000s of records with say 5 columns each and i need all as an object from a query on an Oracle back end.I donot have a clue how to go about this.
I can't see how you will accomplish this on the database side, but you can code this:
I know it isn't what you wanted (on the backend) but it will do what you want. Jamie [ March 21, 2002: Message edited by: Jamie Robertson ]
Kareem Qureshi
Ranch Hand
Joined: Mar 14, 2002
Posts: 102
posted
0
Hi, You can do one more thing, in your sql statement concatenate all the columns so that you get one column and then rs.getString(1) will give you string of all the five columns snippet: select col1 || col2 || col3 || col4 || col5 somename from table; and now as Jamie has given the code append the each row in the result to a stringbuffer object. Hope this helps Kareem
Kareem Qureshi
Ranch Hand
Joined: Mar 14, 2002
Posts: 102
posted
0
Hi, I am sorry i misread your question. You are talking about the rows. Kareem