I have a problem with my Oracle SQL string and don't get the correct result. I have a table with Housenumber and addition in one field, i.e. 16f
As result I want it in 2 Fields:
Housenumber Addition
16 f
- Housenumber is a Number (1 or more digits)
- Addition is a Letter
I have the same Problem with the Fields Ortsname
and Ortszusatz
there it works. But I can't get it with the Housenumber. the result is a duplication of my entries.
WITH TEST_DATA AS
(SELECT distinct '*' Ort, Nummer FROM adresses)
SELECT
Houseid,
Streetid,
Gemeindeschl,
Gemeinde,
Bundesland,
Landkreis,
REGEXP_SUBSTR(t.Ort, '[^,]+', 1, 1) Ort,
REGEXP_SUBSTR(t.Ort, '[^,]+', 1, 2) Ortszusatz,
Strasse,
regexp_substr(t.Nummer, '[^0-9,]',1, 1) Housenumber,
regexp_substr(t.Nummer, '[^A-Z,]',1, 2) Addition,
Objektkl,
Lng,
Lat,
Plz
FROM adresses T