Question
Split String by delimiter position using oracle SQL 28.9 X 30.6
I have a string which contains a '48.6 X 90.6' at COLUMN DIE_SIZE. I want to split this string into size_x and size_y. I can only find a way to split the die_y
Example Strings:
DIE_DIZE |
---|
48.6 X 90.6 |
77.9 X 57.0 |
47.0 X 40.0 |
57.0 X 71.0 |
61.0 X 80.0 |
54.5 X 74.0 |
42.0 X 40.0 |
80.0 X 85.0 |
I write SQL by regexp_substr but i can substring only DIE_Y. Why is this happening and how can I fix it?
select distinct
DIE_SIZE,
regexp_substr(replace(replace(DIE_SIZE,' ',''),'x','X'), '[^X]+$', 2, 1) as die_x,
regexp_substr(replace(replace(DIE_SIZE,' ',''),'x','X'), '[^X]+$', 1, 1) as die_y
from ORD_DIE_LOT
Output from SQL:
DIE_SIZE | DIE_X | DIE_Y |
---|---|---|
48.6 X 90.6 | 90.6 | 90.6 |
77.9 X 57.0 | 57.0 | 57.0 |
... | ... | ... |
Expected output:
DIE_SIZE | DIE_X | DIE_Y |
---|---|---|
48.6 X 90.6 | 48.6 | 90.6 |
77.9 X 57.0 | 77.9 | 57.0 |
... | ... | ... |