Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Extract zip from Address

blueoraSep 30 2010 — edited Sep 30 2010
I want to extract zip from a address e.g. 'McLington, GA. 30226-5547, USA'.
I used this and it is working-

SELECT TRIM(TRANSLATE(REGEXP_REPLACE('McLington, GA. 30226, USA', '[[:alpha:]]',''),'.,',' '))
FROM DUAL;

Is there a simple (less expensive) way to do it?

Also it will not work if there is any other numeric character in this address portion.
OR worse is zip can be in mixed (numeric + non numeric) format. Any solution?

Address could be in any format like-
'McLington, GA. 30226-5547, USA'
'McLington, GA. 30226, USA'
'09880 Bupa, Italy'
'T5D-HJ3 MAINCHESTER, UK' -- This has zip in mixed (numeric + non numeric) format....another problem*****
'McLington-Poppsa, GA. 30226-5547, USA' **** '-' is creating problem.


Thanks.

--Rob

Edited by: roboracle on Sep 30, 2010 1:34 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 28 2010
Added on Sep 30 2010
8 comments
1,652 views