{"id":362,"date":"2014-11-12T09:27:58","date_gmt":"2014-11-12T00:27:58","guid":{"rendered":"http:\/\/www.dbsheetclient.jp\/blog\/?p=362"},"modified":"2018-06-27T16:26:54","modified_gmt":"2018-06-27T07:26:54","slug":"%e3%82%ab%e3%83%bc%e3%82%bd%e3%83%abfor%e3%83%ab%e3%83%bc%e3%83%97oracle","status":"publish","type":"post","link":"https:\/\/www.dbsheetclient.jp\/blog\/?p=362","title":{"rendered":"\u30ab\u30fc\u30bd\u30ebFOR\u30eb\u30fc\u30d7(Oracle)"},"content":{"rendered":"<p>IT\u30b3\u30fc\u30c7\u30a3\u30cd\u30fc\u30bf\u306e\u30b7\u30e5\u30a6\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/IMG_2561.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-363\" src=\"https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/IMG_2561-300x225.jpg\" alt=\"IMG_2561\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/IMG_2561-300x225.jpg 300w, https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/IMG_2561-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><br \/> <\/a><\/p>\n<p>\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304d\u3001EXCEL\u30d6\u30ed\u30b0\u306e\u30e2\u30ab\u3061\u3083\u3093\u3055\u3093\u3088\u308a\u9802\u3044\u305f\u3001\u9577\u91ce\u770c\u5b89\u66c7\u91ce\u306e\u308f\u3055\u3073\u5712\u306e\u5199\u771f\u3067\u3059\u3002\u3068\u3066\u3082\u306e\u3069\u304b\u3067\u5fc3\u304c\u4f11\u307e\u308b\u666f\u8272\u3067\u3059\u306d\u3002<\/p>\n<p><strong>\uff1c\u672c\u65e5\u306e\u984c\u6750\uff1e<br \/> \u30ab\u30fc\u30bd\u30ebFOR\u30eb\u30fc\u30d7(Oracle)<br \/> <\/strong><br \/> \u4eca\u56de\u306f\u3001\u524d\u56de\u306e\u30ab\u30fc\u30bd\u30eb\u306b\u95a2\u9023\u3057\u3066\u3001\u30ab\u30fc\u30bd\u30ebFOR\u30eb\u30fc\u30d7\u306e\u4f7f\u7528\u65b9\u6cd5\u3092\u984c\u6750\u3068\u3057\u307e\u3059\u3002<br \/> \uff11\u884c\uff11\u884c\u3092\u30d5\u30a7\u30c3\u30c1\u3057\u3001\u6700\u5f8c\u306e\u884c\u307e\u3067\u540c\u3058\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3059\u3068\u3044\u3046\u3053\u3068\u3092\u30ab\u30fc\u30bd\u30eb\u51e6\u7406\u3067\u884c\u3044\u307e\u3059\u304c\u3001\u305d\u308c\u3092\u3088\u308a\u30b7\u30f3\u30d7\u30eb\u306b\u8a18\u8ff0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u304c\u3001\u30ab\u30fc\u30bd\u30ebFOR\u30eb\u30fc\u30d7\u3067\u3059\u3002\u30ab\u30fc\u30bd\u30eb\u51e6\u7406\u3067\u5fc5\u8981\u306a\u4ee5\u4e0b\u306e\u51e6\u7406\u304c\u81ea\u52d5\u5316\u3055\u308c\u3001\u51e6\u7406\u5168\u4f53\u304c\u5358\u7d14\u5316\u3055\u308c\u307e\u3059\u3002<br \/> \u30fbOPEN\u3001FETCH\u3001CLOSE\u6587\u306e\u6307\u5b9a<br \/> \u30fb\u53d6\u308a\u51fa\u3057\u305f\u884c\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3059\u308b\u305f\u3081\u306e\u5909\u6570\u306e\u5b9a\u7fa9<br \/> <strong><br \/> \u3010\u30ab\u30fc\u30bd\u30ebFOR<\/strong><strong>\u30eb\u30fc\u30d7\u306e\u8a18\u8ff0\u3011<br \/> <\/strong>DECLARE<br \/> \u30ab\u30fc\u30bd\u30eb\u306e\u5b9a\u7fa9 (CURSOR &lt;\u30ab\u30fc\u30bd\u30eb\u540d&gt; IS &lt;SELECT\u6587&gt;)<br \/> BEGIN<br \/> FOR &lt;\u30eb\u30fc\u30d7\u7d22\u5f15\u540d&gt; IN &lt;\u30ab\u30fc\u30bd\u30eb\u540d&gt; LOOP<br \/> \u51e6\u7406<br \/> END LOOP;<br \/> END;<\/p>\n<p>\u524d\u56de\u306e\u4f8b\u3092\u30ab\u30fc\u30bd\u30ebFOR\u30eb\u30fc\u30d7\u3067\u7f6e\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<p>DECLARE<br \/> CURSOR jyutyu_cur IS<br \/> SELECT J01.\u53d7\u6ce8\u756a\u53f7, J01.\u9867\u5ba2\u756a\u53f7, J01.\u53d7\u6ce8\u65e5, J02.\u5546\u54c1CD, J02.\u5546\u54c1\u6570<br \/> FROM \u53d7\u6ce8\u30c6\u30fc\u30d6\u30eb J01<br \/> JOIN \u53d7\u6ce8\u660e\u7d30\u30c6\u30fc\u30d6\u30eb J02 ON J01.\u53d7\u6ce8\u756a\u53f7 = J02.\u53d7\u6ce8\u756a\u53f7<br \/> WHERE TO_CHAR(J01.\u53d7\u6ce8\u65e5, &#8216;YYYYMMDD&#8217;) = TO_CHAR(SYSDATE, &#8216;YYYYMMDD&#8217;)<br \/> ORDER BY J01.\u53d7\u6ce8\u756a\u53f7, J02.\u53d7\u6ce8\u660e\u7d30\u756a\u53f7;<\/p>\n<p>V_\u5728\u5eab\u6570 \u5728\u5eab\u30c6\u30fc\u30d6\u30eb.\u5728\u5eab\u6570%TYPE;<\/p>\n<p>BEGIN<br \/> FOR jyutyu_rec IN jyutyu_cur LOOP<\/p>\n<p>SELECT \u5728\u5eab\u6570 INTO V_\u5728\u5eab\u6570 FROM \u5728\u5eab\u30c6\u30fc\u30d6\u30eb<br \/> WHERE \u5546\u54c1CD = jyutyu_rec.\u5546\u54c1CD;<\/p>\n<p>IF V_\u5728\u5eab\u6570 &gt;= jyutyu_rec.\u5546\u54c1\u6570 THEN<br \/> DBMS_OUTPUT.PUT_LINE(&#8216;\u53d7\u6ce8\u756a\u53f7=&#8217;|| jyutyu_rec.\u53d7\u6ce8\u756a\u53f7||&#8217;,\u5546\u54c1CD=&#8217;|| jyutyu_rec.\u5546\u54c1CD||&#8217;,\u5546\u54c1\u6570=&#8217;|| jyutyu_rec.\u5546\u54c1\u6570||&#8217;, \u5f15\u5f53OK&#8217;);<\/p>\n<p>UPDATE \u5728\u5eab\u30c6\u30fc\u30d6\u30eb SET<br \/> \u5728\u5eab\u6570 = \u5728\u5eab\u6570 &#8211; jyutyu_rec.\u5546\u54c1\u6570<br \/> WHERE \u5546\u54c1CD = jyutyu_rec.\u5546\u54c1CD;<\/p>\n<p>ELSIF V_\u5728\u5eab\u6570 &lt; jyutyu_rec.\u5546\u54c1\u6570 THEN<br \/> DBMS_OUTPUT.PUT_LINE(&#8216;\u53d7\u6ce8\u756a\u53f7=&#8217;|| jyutyu_rec.\u53d7\u6ce8\u756a\u53f7||&#8217;,\u5546\u54c1CD=&#8217;|| jyutyu_rec.\u5546\u54c1CD||&#8217;,\u5546\u54c1\u6570=&#8217;|| jyutyu_rec.\u5546\u54c1\u6570||&#8217;, \u5f15\u5f53\u4e0d\u53ef&#8217;);<br \/> END IF;<br \/> END LOOP;<br \/> END;<br \/> \/<\/p>\n<p>\u7d50\u679c\u306f\u3001\u4ee5\u4e0b<br \/> <a href=\"https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/\u30ab\u30fc\u30bd\u30eb\u7d50\u679c2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-359\" src=\"https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/\u30ab\u30fc\u30bd\u30eb\u7d50\u679c2-300x185.jpg\" alt=\"\u30ab\u30fc\u30bd\u30eb\u7d50\u679c2\" width=\"324\" height=\"200\" srcset=\"https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/\u30ab\u30fc\u30bd\u30eb\u7d50\u679c2-300x185.jpg 300w, https:\/\/www.dbsheetclient.jp\/blog\/wp-content\/uploads\/2014\/11\/\u30ab\u30fc\u30bd\u30eb\u7d50\u679c2.jpg 493w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/><br \/> <\/a><\/p>\n<p>\u7d50\u679c\u306f\u524d\u56de\u3068\u540c\u3058\u3067\u3059\u3002\u8a18\u8ff0\u304c\u3044\u304f\u3076\u3093\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u65e5\u306f\u4ee5\u4e0a\u307e\u3067<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IT\u30b3\u30fc\u30c7\u30a3\u30cd\u30fc\u30bf\u306e\u30b7\u30e5\u30a6\u3067\u3059\u3002 \u524d\u56de\u306b\u5f15\u304d\u7d9a\u304d\u3001EXCEL\u30d6\u30ed\u30b0\u306e\u30e2\u30ab\u3061\u3083\u3093\u3055\u3093\u3088\u308a\u9802\u3044\u305f\u3001\u9577\u91ce\u770c\u5b89\u66c7\u91ce\u306e\u308f\u3055\u3073\u5712\u306e\u5199\u771f\u3067\u3059\u3002\u3068\u3066\u3082\u306e\u3069\u304b\u3067\u5fc3\u304c\u4f11\u307e\u308b\u666f\u8272\u3067\u3059\u306d\u3002 \uff1c\u672c\u65e5\u306e\u984c\u6750\uff1e \u30ab\u30fc\u30bd\u30ebFOR\u30eb\u30fc\u30d7(Oracle)  [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[11],"tags":[],"class_list":["post-362","post","type-post","status-publish","format-standard","hentry","category-11"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=362"}],"version-history":[{"count":9,"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions"}],"predecessor-version":[{"id":1973,"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions\/1973"}],"wp:attachment":[{"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbsheetclient.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}