{"id":415,"date":"2020-08-15T15:43:42","date_gmt":"2020-08-15T06:43:42","guid":{"rendered":"https:\/\/outdoor-development.work\/index\/?p=415"},"modified":"2020-08-15T15:45:54","modified_gmt":"2020-08-15T06:45:54","slug":"%e3%80%90oracle%e3%80%91%e3%80%90pl-sql%e3%80%91%e5%b9%b4%e6%9c%88%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ae1%e5%b9%b4%e5%be%8c%e3%82%92%e5%8f%96%e5%be%97%e3%81%99%e3%82%8badd_months","status":"publish","type":"post","link":"https:\/\/outdoor-development.work\/index\/2020\/08\/15\/%e3%80%90oracle%e3%80%91%e3%80%90pl-sql%e3%80%91%e5%b9%b4%e6%9c%88%e3%83%87%e3%83%bc%e3%82%bf%e3%81%ae1%e5%b9%b4%e5%be%8c%e3%82%92%e5%8f%96%e5%be%97%e3%81%99%e3%82%8badd_months\/","title":{"rendered":"\u3010Oracle\u3011\u3010PL\/SQL\u3011\u5e74\u6708\u30c7\u30fc\u30bf\u306e1\u5e74\u5f8c\u3092\u53d6\u5f97\u3059\u308b(ADD_MONTHS)"},"content":{"rendered":"\n<h1>\u5e74\u6708\u30c7\u30fc\u30bf\u306e1\u5e74\u5f8c\u3092\u53d6\u5f97\u3059\u308b(ADD_MONTHS)<\/h1>\n\n<h2>\u3084\u308a\u305f\u3044\u3053\u3068<\/h2>\n\n<p><code>ADD_MONTHS<\/code>\u95a2\u6570\u306f\u6307\u5b9a\u3057\u305f\u65e5\u6642\u306b\u6307\u5b9a\u306e\u6708\u6570\u3092\u8db3\u3057\u3066\u8fd4\u3059\u95a2\u6570\u3067\u3059\u3002<\/p>\n\n<pre><code class=\"language-sql\">SELECT \n    ADD_MONTHS(SYSDATE,1), -- 1\u30f6\u6708\u5f8c\u306e\u65e5\u4ed8\u3092\u53d6\u5f97\n    ADD_MONTHS(SYSDATE,12) -- 1\u5e74\u5f8c\u306e\u65e5\u4ed8\u3092\u53d6\u5f97\nFROM dual;\n<\/code><\/pre>\n\n<p>\u3053\u3053\u3067\u306f\u3053\u306e\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3001\u5e74(yyyy)\u3084\u5e74\u6708(yyyymm)\u3068\u3044\u3063\u305f\u30c7\u30fc\u30bf\u306e1\u5e74\u5f8c\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br>\n<code>ADD_MONTHS<\/code>\u95a2\u6570\u306f\u5e74\u6708\u65e5\u63c3\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306b\u5bfe\u3057\u51e6\u7406\u3092\u884c\u3046\u305f\u3081\u3001\u5e74\u3084\u5e74\u6708\u306e\u30c7\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u306f\u305d\u306e\u307e\u307e\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n<h2>\u30b3\u30fc\u30c9<\/h2>\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u304c\u5b58\u5728\u3057\u305f\u6642\u306b\u4e0b\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3001\u305d\u308c\u305e\u308c1\u5e74\u5f8c\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n\n<table>\n<thead>\n<tr>\n<th align=\"center\">\u5e74<\/th>\n<th align=\"center\">\u5e74\u6708<\/th>\n<\/tr>\n<\/thead>\n\n<tbody>\n<tr>\n<td align=\"center\">2019<\/td>\n<td align=\"center\">201904<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u53d6\u5f97\u3057\u305f\u3044\u5185\u5bb9<\/strong><\/p>\n\n<table>\n<thead>\n<tr>\n<th align=\"center\">\u5e74<\/th>\n<th align=\"center\">\u5e74\u6708<\/th>\n<\/tr>\n<\/thead>\n\n<tbody>\n<tr>\n<td align=\"center\">2020<\/td>\n<td align=\"center\">202004<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n<pre><code class=\"language-SQL\">SELECT\n    TO_CHAR(ADD_MONTHS(CONCAT(test_yyyy,'0101'),12),'yyyy'),      -- yyyy\u5f62\u5f0f\n    TO_CHAR(ADD_MONTHS(CONCAT(test_yyyymm,'01'),12),'yyyymm')     -- yyyymm\u5f62\u5f0f\nFROM dual;\n<\/code><\/pre>\n\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u884c\u3063\u3066\u3044\u308b\u306e\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5185\u5bb9\u3067\u3059\u3002<br>\n\u30fb<code>CONCAT<\/code>\u95a2\u6570\u3067\u5e74\u306e\u307f\u3082\u3063\u3066\u3044\u306a\u3044\u30c7\u30fc\u30bf\u306b\u7591\u4f3c\u7684\u306b\u6708\u65e5\u306e\u30c7\u30fc\u30bf\u3092\u4ed8\u4e0e\u3059\u308b<br>\n\u30fb<code>ADD_MONTHS<\/code>\u95a2\u6570\u306712\u30f6\u6708\u5f8c(1\u5e74\u5f8c)\u306e\u65e5\u4ed8\u3092\u53d6\u5f97\u3059\u308b<br>\n\u30fb<code>TO_CHAR<\/code>\u95a2\u6570\u3067\u53d6\u5f97\u3057\u305f\u65e5\u4ed8\u3092\u6210\u578b\u3057\u306a\u304a\u3059<\/p>\n\n<div class=\"veu_socialSet veu_contentAddSection\"><script>window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src=\"https:\/\/platform.twitter.com\/widgets.js\";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,\"script\",\"twitter-wjs\"));<\/script><ul><li class=\"sb_twitter sb_icon\"><a href=\"\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Foutdoor-development.work%2Findex%2F2020%2F08%2F15%2F%25e3%2580%2590oracle%25e3%2580%2591%25e3%2580%2590pl-sql%25e3%2580%2591%25e5%25b9%25b4%25e6%259c%2588%25e3%2583%2587%25e3%2583%25bc%25e3%2582%25bf%25e3%2581%25ae1%25e5%25b9%25b4%25e5%25be%258c%25e3%2582%2592%25e5%258f%2596%25e5%25be%2597%25e3%2581%2599%25e3%2582%258badd_months%2F&amp;text=Outdoor+Development\" target=\"_blank\" ><span class=\"vk_icon_w_r_sns_twitter icon_sns\"><\/span><span class=\"sns_txt\">twitter<\/span><\/a><\/li><\/ul><\/div><!-- [ \/.socialSet ] -->","protected":false},"excerpt":{"rendered":"<p>\u5e74\u6708\u30c7\u30fc\u30bf\u306e1\u5e74\u5f8c\u3092\u53d6\u5f97\u3059\u308b(ADD_MONTHS) \u3084\u308a\u305f\u3044\u3053\u3068 ADD_MONTHS\u95a2\u6570\u306f\u6307\u5b9a\u3057\u305f\u65e5\u6642\u306b\u6307\u5b9a\u306e\u6708\u6570\u3092\u8db3\u3057\u3066\u8fd4\u3059\u95a2\u6570\u3067\u3059\u3002 SELECT ADD_MONTHS(SYSDATE,1), &#8212; 1\u30f6\u6708\u5f8c\u306e\u65e5 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44],"tags":[],"_links":{"self":[{"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/posts\/415"}],"collection":[{"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/comments?post=415"}],"version-history":[{"count":3,"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/posts\/415\/revisions"}],"predecessor-version":[{"id":418,"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/posts\/415\/revisions\/418"}],"wp:attachment":[{"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/media?parent=415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/categories?post=415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/outdoor-development.work\/index\/wp-json\/wp\/v2\/tags?post=415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}