I have table in Oracle SQL like below:
col1 -------- ABC|1234 ABC|55674 ABC|11
So I have in col1:
- always “ABC|” at the begining of each value
- different length of values after “ABC|”
I need result like below, so I need to delete “ABC|” from begining of each value
col1 --------------- 1234 55674 11
How can I do that in Oracle SQL ?
Advertisement
Answer
A simple substring operation might be easiest here:
SELECT col1, SUBSTR(col1, 5) AS col1_out FROM yourTable;
You could also do a replacement:
SELECT col1, REPLACE(col1, 'ABC|', '') AS col1_out FROM yourTable;