I need to get substring of String in oralce till a character is found. if Character is not found it should show entire string
Ex :
- ABC_DEF
- XY_Z
- PQRS
Expected result is
- ABC
- XY
- PQRS
I tried below query But it will not work in case search charcter "_" is not found.
SELECT SUBSTR('ABC_X', 0, INSTR('ABC_X', '_')-1) AS output
FROM DUAL