{"id":1609,"date":"2010-02-10T03:45:36","date_gmt":"2010-02-10T09:45:36","guid":{"rendered":"http:\/\/www.mrc-productivity.com\/docs\/?page_id=1609"},"modified":"2023-06-20T15:59:11","modified_gmt":"2023-06-20T20:59:11","slug":"validating-via-an-sql-procedure-source-code","status":"publish","type":"ht_kb","link":"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/validating-via-an-sql-procedure-source-code","title":{"rendered":"Validating via an SQL Procedure Source Code"},"content":{"rendered":"\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">mrc recommends using the <a href=\"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/workflow-designer#setting-a-condition\">Workflow Designer<\/a> to validate user input going forward.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Source Code<\/h3>\n\n\n\n<p><code>create procedure mrcworklib.validdates<br>\n(inout i_error char(99),<br>\n&nbsp;inout i_strdate decimal(8,0),<br>\n&nbsp;inout i_enddate decimal(8,0))<br>\nLANGUAGE SQL<br>\nCASE<br>\nwhen i_strdate = 0 and i_enddate = 0 then<br>\n&nbsp;&nbsp;&nbsp;set i_error = 'You have not entered any dates.';<br>\nwhen i_strdate = 0 then<br>\n&nbsp;&nbsp;&nbsp;set i_error = 'You must enter a starting date.';<br>\nwhen i_enddate = 0 then<br>\n&nbsp;&nbsp;&nbsp;set i_error = 'You must enter an ending date.';<br>\nwhen i_strdate &gt; i_enddate then<br>\n&nbsp;&nbsp;&nbsp;set i_error = 'Start date is later than end date.';<br>\nelse<br>\n&nbsp;&nbsp;&nbsp;set i_error = ' ';<br>\nEND CASE<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source Code create procedure mrcworklib.validdates (inout i_error char(99), &nbsp;inout i_strdate decimal(8,0), &nbsp;inout i_enddate decimal(8,0)) LANGUAGE SQL CASE when i_strdate = 0 and i_enddate = 0 then &nbsp;&nbsp;&nbsp;set i_error = &#8216;You have not entered any dates.&#8217;; when i_strdate = 0 then &nbsp;&nbsp;&nbsp;set i_error = &#8216;You must enter a starting date.&#8217;; when&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[],"ht-kb-tag":[],"class_list":["post-1609","ht_kb","type-ht_kb","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/1609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/comments?post=1609"}],"version-history":[{"count":4,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/1609\/revisions"}],"predecessor-version":[{"id":12868,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/1609\/revisions\/12868"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/media?parent=1609"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=1609"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=1609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}