Oracle Question: Split String into two
-
Hi all, How do you use the REGEXP_SUBSTR function to split a string into two? Specifically, I want to split a string into two where " and " is the delimiter (note the whitespace). So for example, if the string is "xande and zem and dem and doe", I want string 1 to be "xande" and string 2 to be "zem and dem and doe". Any help would be greatly appreciated. Thanks
-
Hi all, How do you use the REGEXP_SUBSTR function to split a string into two? Specifically, I want to split a string into two where " and " is the delimiter (note the whitespace). So for example, if the string is "xande and zem and dem and doe", I want string 1 to be "xande" and string 2 to be "zem and dem and doe". Any help would be greatly appreciated. Thanks
case
when instr(mystring, ' and ') > 0 then substr(mystring, 0, instr(mystring, ' and ')-1)
else mystring
end as string1
case
when instr(mystring, ' and ') > 0 then substr(mystring, instr(mystring, ' and ') + length(' and '))
else null
end as string2Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
case
when instr(mystring, ' and ') > 0 then substr(mystring, 0, instr(mystring, ' and ')-1)
else mystring
end as string1
case
when instr(mystring, ' and ') > 0 then substr(mystring, instr(mystring, ' and ') + length(' and '))
else null
end as string2Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions
-
You're welcome
Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions