I have
select col1,
( REGEXP_SUBSTR ( col2, ' ( ?<=~ ) .*? ( ?=ABCD ) ' )
|| SUBSTRING ( col2 FROM POSITION ( 'ABCD' IN col2 )
FOR POSITION ( '~' IN SUBSTRING ( col2 FROM POSITION ( 'ABCD' IN col2 ) ) ) -1 ) as xyz)
from db.table
where col2 like '%ABCD%';
I have a field with values as decribed in below pattern.
Name1#Value1 ~ Name2#Value2 ~ ......... ~ NameX#ValueX ~ ........... ~ NameN#ValueN
There is no limit for number of name&value sections. One such Name will have 'ABCD' pattern. I want to extract that section of name and value which contains the 'ABCD' pattern and put it in a separate field.
My code above throws
"substring out of bounds"
error.
Help is greatly appreciated. Thank you.