Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 8th, 2004, 01:04 AM
noir126 noir126 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 noir126 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Urgent! Can someone help? (Split field)

Hi,
I have a table call employee. The thing i need to do is to seperate the address field into street number and street name. e.g. 3/123 Bay street in the address field seperate into 3/123 into street number and Bay Street into street name. Anyone know how to do this? Thanks a lot.

Last edited by pabloj : April 8th, 2004 at 03:53 AM. Reason: Added descriptive subject

Reply With Quote
  #2  
Old April 8th, 2004, 03:49 AM
SeaBird505 SeaBird505 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 25 SeaBird505 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 50 sec
Reputation Power: 0
This is one of the few solutions possable. You will need to add two columns and update the data into them from Address field. Then delete the address field (if possable, depends on Oracle version) or simply leave it empty.

Code:
Alter table employee add (StNo varchar2(XX1), StName varchar2(XX2));

update employee set StNo=SubStr(address, 1, STNO_LEN) , StName=SubStr(address, STNO_LEN+2);

-- If all is fine, Optionally
Update employee set address=null;

--Don't forget to commit
commit;


IMP: The above code assumes that StName starts after a fix length in the address field. If not replace the SubStr part like

SubStr(address,1, instr(address,' ')-1)
SubStr(address,instr(address, ' ')+1)

respectively. This shall work if StNo and StName in address are separated by a single space no matter if StNo occupies variable length at times.

Regards, SeaBird.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Urgent! Can someone help?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway