{"id":969,"date":"2021-09-21T18:09:54","date_gmt":"2021-09-21T22:09:54","guid":{"rendered":"https:\/\/folvera.commons.gc.cuny.edu\/?p=969"},"modified":"2021-09-23T11:20:11","modified_gmt":"2021-09-23T15:20:11","slug":"cuny-ace-upskilling-introduction-to-structured-query-language-sf21job-day-8","status":"publish","type":"post","link":"https:\/\/folvera.commons.gc.cuny.edu\/?p=969","title":{"rendered":"CUNY ACE Upskilling: Introduction to Structured Query Language (SF21JOB) \u2014 Day 8"},"content":{"rendered":"<p>We are reaching the end of the course and this means programmability.<\/p>\n<pre><span style=\"color: #0000ff\">    CREATE PROCEDURE<\/span> quick_example @in_param <span style=\"color: #0000ff\">VARCHAR<\/span>(50)\r\n      <span style=\"color: #339966\">-- passing a value into the procedure using parameter\r\n      -- `@in_param` declared as a VARCHAR(50)<\/span>\r\n    <span style=\"color: #0000ff\">AS<\/span>\r\n      <span style=\"color: #0000ff\">BEGIN<\/span>\r\n      <span style=\"color: #339966\">-- beginning of code do something when executing this \r\n      -- procedure<\/span>\r\n        <span style=\"color: #0000ff\">DECLARE<\/span> @out_param <span style=\"color: #0000ff\">VARCHAR<\/span>(50)\r\n            <span style=\"color: #339966\">-- receive value from it has been processed, using \r\n            -- the same data type (VARCHAR(50))<\/span>\r\n        <span style=\"color: #0000ff\">SET<\/span> @out_param = <span style=\"color: #ff00ff\">CONCAT<\/span> (\r\n            <span style=\"color: #ff0000\">'`'<\/span>,\r\n            @in_param,\r\n            <span style=\"color: #ff0000\">'` processed as `'<\/span>,\r\n            <span style=\"color: #ff00ff\">UPPER<\/span>(@in_param),\r\n            <span style=\"color: #ff0000\">'`'<\/span>\r\n            )\r\n            <span style=\"color: #339966\">-- passing a value. the original value processed<\/span>\r\n        <span style=\"color: #0000ff\">PRINT<\/span> @out_param\r\n            <span style=\"color: #339966\">-- printing the value of the output parameter<\/span>\r\n      <span style=\"color: #339966\">-- end of code to do something when executing this procedure<\/span>\r\n      <span style=\"color: #0000ff\">END;\r\n<\/span><\/pre>\n<p>Download the\u00a0<a title=\"Class Notes for SF21JOB - Day 8 (2021\/09\/20)\" href=\"https:\/\/folvera.commons.gc.cuny.edu\/wp-content\/blogs.dir\/2501\/files\/2021\/09\/SF21JOB_20210920.pdf\">class notes<\/a> for day 8.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are reaching the end of the course and this means programmability. CREATE PROCEDURE quick_example @in_param VARCHAR(50) &#8212; passing a value into the procedure using parameter &#8212; `@in_param` declared as a VARCHAR(50) AS BEGIN &#8212; beginning of code do something when executing this &#8212; procedure DECLARE @out_param VARCHAR(50) &#8212; receive value from it has been [&hellip;]<\/p>\n","protected":false},"author":7213,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"send_to_group_blog":0,"footnotes":""},"categories":[28,3,1,17,2],"tags":[],"class_list":["post-969","post","type-post","status-publish","format-standard","hentry","category-sf21job","category-computer-programming","category-cuny","category-open-source","category-sql"],"_links":{"self":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/969","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/users\/7213"}],"replies":[{"embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=969"}],"version-history":[{"count":5,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/969\/revisions"}],"predecessor-version":[{"id":977,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=\/wp\/v2\/posts\/969\/revisions\/977"}],"wp:attachment":[{"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/folvera.commons.gc.cuny.edu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}