Advertisement
tmmdv

match_recognize

Mar 1st, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. with t as
  2. (select 1 id11, 10 id12, 1 id21, 10 id22 from dual union all
  3. select 2, null, 2, null from dual union all
  4. select 3, null, 15, null from dual union all
  5. select 4, null, 9, null from dual)
  6. select
  7. id11
  8. from t
  9. match_recognize
  10. (
  11. order by id11, id21
  12. measures classifier() as cls
  13. all rows per match
  14. pattern (a b+)
  15. define
  16. a as id12 is not null and id22 is not null,
  17. b as id11 <= prev(id12) and id11 >= prev(id11) and id21 <= prev(id22) and id21 >= prev(id21)
  18. )
  19. where cls = 'B'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement