I was doing a query in oracle in which i have to update a col2 using col1 specified in col1 so data in col1 is dynamic i.e. there can be any no. Of / So i want ... Col2 be updated as trimmed value from the last slash of col1.
Input
Col1 Col2
a data
a/bb data
a/b/c data
a/bbc/c/d/ data
Output
Col1 Col2
a data
a/b data/a
a/b/c data/a/b
a/bbc/c/d/ data/a/bbc/c
I tried it to do it using regexp_substr but it's dynamic. My query is working for only one or two slashes something like this [^/]{1}
So, help me do it dynamically