By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select substr(varchar_col, 1, instr(varchar_col, '__'))
from (select 'keep_this__discard_this' as varchar_col union all
select 'keep_this_too__discard_this') x
substr(varchar_col, 1, instr(varchar_col, '__')) |
---|
keep_this_ |
keep_this_too_ |