{"id":3150,"date":"2025-06-30T08:49:30","date_gmt":"2025-06-30T08:49:30","guid":{"rendered":"https:\/\/aprogrammerwrites.eu\/?p=3150"},"modified":"2025-06-30T08:49:30","modified_gmt":"2025-06-30T08:49:30","slug":"coupons-caps-and-functions-intro","status":"publish","type":"post","link":"https:\/\/aprogrammerwrites.eu\/?p=3150","title":{"rendered":"Coupons, Caps and Functions &#8211; Intro"},"content":{"rendered":"<p>I recently posted an article on my GitHub Pages blog, <a href=\"https:\/\/brenpatf.github.io\/2025\/06\/29\/coupons_caps_functions.html\" target=\"_blank\" rel=\"noopener\">Coupons, Caps and Functions<\/a>.<\/p>\n<h2>[Here is the introduction&#8230;]<\/h2>\n<p>On 18 April 2025 a poster asked a question on the AskTom Oracle forum:<br \/>\n<a href=\"https:\/\/asktom.oracle.com\/ords\/asktom.search?tag=solving-a-logical-problem-using-analytical-functions\" target=\"_blank\" rel=\"noopener\">Solving a logical problem using analytical functions<\/a>. The problem turned out to be surprisingly difficult to solve in pure SQL.<\/p>\n<p>I posted two solution methods on the thread for a generalised form of the problem. One solution used Oracle&#8217;s MODEL clause, the other a pipelined function. In this article, I explain how these work, and add a third method based on recursive subquery factoring. In addition, I analyse the performance characteristics of the three methods using an approach I presented at the 2017 Irish Oracle User Group conference in Dublin, <a href=\"http:\/\/aprogrammerwrites.eu\/?p=2012\" target=\"_blank\" rel=\"noopener\">Dimensional Performance Benchmarking of SQL<\/a>. The analysis includes curve-fitting using Excel graphs and statistical functions.<\/p>\n<p>The methods are tested using <a href=\"https:\/\/brenpatf.github.io\/2023\/06\/05\/the-math-function-unit-testing-design-pattern.html\" target=\"_blank\" rel=\"noopener\">The Math Function Unit Testing Design Pattern<\/a>, with test results in HTML and text format included.<\/p>\n<p>Everything is automated.<\/p>\n<h3>GitHub<\/h3>\n<p><img decoding=\"async\" style=\"width: 10%; max-width: 5%;\" src=\"http:\/\/aprogrammerwrites.eu\/wp-content\/uploads\/2024\/08\/github-mark.png\" \/><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/BrenPatF\/coupon_caps_oracle\" target=\"_blank\" rel=\"noopener\">Coupons, Caps and Functions in Oracle<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><!-- AddThis Button BEGIN --><\/p>\n<div class=\"addthis_toolbox addthis_default_style \"><\/div>\n<p><script type=\"text\/javascript\">var addthis_config = {\"data_track_addressbar\":true};<\/script><br \/>\n<script type=\"text\/javascript\" src=\"\/\/s7.addthis.com\/js\/300\/addthis_widget.js#pubid=ra-50fd09b73778290b\"><\/script><br \/>\n<!-- AddThis Button END --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently posted an article on my GitHub Pages blog, Coupons, Caps and Functions. [Here is the introduction&#8230;] On 18 April 2025 a poster asked a question on the AskTom Oracle forum: Solving a logical problem using analytical functions. The &hellip; <a href=\"https:\/\/aprogrammerwrites.eu\/?p=3150\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-3150","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4FdtN-OO","_links":{"self":[{"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=\/wp\/v2\/posts\/3150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3150"}],"version-history":[{"count":2,"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=\/wp\/v2\/posts\/3150\/revisions"}],"predecessor-version":[{"id":3152,"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=\/wp\/v2\/posts\/3150\/revisions\/3152"}],"wp:attachment":[{"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aprogrammerwrites.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}