We have a varchar2 column called House_Number, which has all different kind of data entries as shown below. And all I need is the numbers from left to the first occurrence of a non-numeric like space, special characters and ascii characters.
Below are some sample house_numbers:
217 3RDFL, 2173RDFL, 500D, 527 # 2ND, 527# 2ND, 5422NDFL, 5422, 30# D2,
1250 2ND, 12502ND, 217 3RDFL, 2173RDFL, 5241R, 3 2R, 32R, 5092R, 24 # 2R,
24# 2R, 129 B-16, 129# B17, 129B-16, 16 # 2B, 4229B, 539# APT 3, 563 # A5,
2162A, 934-A, 109-A, 511-A, 339-REA, 339REAR
And for the above house_numbers, the expected corresponding outputs is as follows:
217, 217, 500, 527, 527, 542, 542, 30,1250,1250, 217, 217, 5241,
3, 32, 5092, 24, 24, 129, 129, 129, 16, 4229, 539, 563, 2162,
934, 109, 511, 339, 339
I tried using regexp_substr, but i could not get a logic which will work for all the different data inputs as shown above.
Would really appreciate if someone can help.