Pattern Matching Over Rows

This topic was inspired by Tom Kyte's So, in your opinion ... blog post about a new SQL feature Oracle is considering (described at Pattern matching in sequences of rows).

I'll admit I've never tackled this kind of pattern matching before and I didn't understand the entire paper. It's a pretty dense read. From what I can tell though, using the new feature would be a lot like applying regular expressions to rows of values. This got me thinking. Instead of adding a whole new feature for this, why not simply convert the rows into strings (see SQL Techniques Tutorials: Rows to String) and then use existing regular expression support to do the pattern matching?

Even if the feature described in the paper does something more sophisticated than this, tackling the requirement with existing functionality using simple string aggregation logic and regular expressions sounded like a fun challenge. Here's my stab at a solution.




Linking to SQL Snippets ™

To link to this page in Oracle Technology Network Forums or OraFAQ Forums cut and paste this code.

  • [url=http://www.sqlsnippets.com/en/topic-12162.html]SQL Snippets: SQL Techniques Tutorials - Pattern Matching Over Rows[/url]

To link to this page in HTML documents or Blogger comments cut and paste this code.

  • <a href="http://www.sqlsnippets.com/en/topic-12162.html">SQL Snippets: SQL Techniques Tutorials - Pattern Matching Over Rows</a>

To link to this page in other web sites use the following values.

  • Link Text : SQL Snippets: SQL Techniques Tutorials - Pattern Matching Over Rows
  • URL (href): http://www.sqlsnippets.com/en/topic-12162.html