Created
November 5, 2016 01:56
-
-
Save tangotiger/a693648b65aa54d7bf2bb387210d6cb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
rs as ( | |
select | |
instr(play_string,',',1,6) as comma_position | |
, play_string | |
from mytable | |
where substr(play_string,1,4)='play' | |
) | |
, | |
rs2 as ( | |
select | |
substr(play_string,1,comma_position-2) as prefix_parse | |
, substr(play_string,comma_position-1,1)as replace_parse | |
, substr(play_string,comma_position) as suffix_parse | |
, rs.* | |
from rs | |
) | |
select | |
play_string | |
, prefix_parse || 'X' || suffix_parse as new_play_string | |
from rs2 | |
where replace_parse in ('D', 'E') | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment