Getting Examples from similar Stack Overflow threads, Remove all characters after a specific character in PL/SQL and How to Select a substring in Oracle SQL up to a specific character?
I would want to retrieve only the first characters before the occurrence of a string.
Example:
STRING_EXAMPLE
TREE_OF_APPLES
The Resulting Data set should only show only STRING_EXAM
and TREE_OF_AP
because PLE
is my delimiter
Whenever i use the below REGEXP_SUBSTR
, It gets only STRING_
because REGEXP_SUBSTR
treats PLE
as separate expressions (P, L and E)
, not as a single expression (PLE)
.
SELECT REGEXP_SUBSTR('STRING_EXAMPLE','[^PLE]+',1,1) from dual;
How can i do this without using numerous INSTRs and SUBSTRs?
Thank you.