Home » RDBMS Server » Server Administration » Concatenating multi line data
Concatenating multi line data [message #371269] Mon, 25 September 2000 23:44 Go to next message
Matt
Messages: 43
Registered: September 1999
Member
Hello.

I download masses of property ownership data from a mainframe each night, and create tables in a similar form to those that are stored on said mainframe. For example :
Prop_Num Owner Address
11234 Husband 123 First Street
11234 Wife 123 First Street

I would like to create a table or view with the data looking a little like this :
Prop_Num Owners Address
11234 Husband and Wife 123 First Street

Does anyone have any ideas on doing this.

Thanks in advance ....

Matt
Re: Concatenating multi line data [message #371280 is a reply to message #371269] Wed, 27 September 2000 07:52 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
you can try this update statments.

update t1 set owners = (select a.owners || ' and ' || b.owners
from t1 a, t1 b
where a.prop_num = b.prop_num
and a.rowid > b.rowid)
/

select * from t1;
prop_num owners address
11234 husband and wife 123 first street
11234 husband and wife 123 first street

now you can delete the duplicate records.

Good Luck
Bala.
Re: Concatenating multi line data [message #371281 is a reply to message #371269] Wed, 27 September 2000 07:52 Go to previous message
Bala
Messages: 205
Registered: November 1999
Senior Member
you can try this update statments.

update t1 set owners = (select a.owners || ' and ' || b.owners
from t1 a, t1 b
where a.prop_num = b.prop_num
and a.rowid > b.rowid)
/

select * from t1;
prop_num owners address
11234 husband and wife 123 first street
11234 husband and wife 123 first street

now you can delete the duplicate records.

Good Luck
Bala.
Previous Topic: Student question Re. Forms 6 to open word documents
Next Topic: How can I import the data from excel to oracle 8?
Goto Forum:
  


Current Time: Tue Apr 23 10:57:09 CDT 2024