Saturday, February 22, 2014

Mimic Row Pattern Matching in Oracle 11g


Oracle 12c introduced MATCH_RECOGNIZE clause for row pattern matching. If you are still using Oracle 11g, you can use listagg() and regexp_like() to implement row pattern matching. For example, in order to find users with event A followed by event D (other events allowed in between),

UserSequenceEvent
11A
12D
13C
14B
21C
22B
23A
31A
32C
33D

you can use the following query:

No comments: