|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Urgent! Can someone help? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|