How to use match_recognize with SQL macros to create reusable SQL fragments
You can get the scripts for the SQL examples in Live SQL:
https://livesql.oracle.com/apex/livesql/file/content_KPBT70LOJM9EIEWT5WWQTMXRN.html
https://livesql.oracle.com/apex/livesql/file/content_KPC7JMI7AXP22YR76GWPFITCT.html