{"id":238010,"date":"2020-12-28T15:17:56","date_gmt":"2020-12-28T07:17:56","guid":{"rendered":"http:\/\/4563.org\/?p=238010"},"modified":"2020-12-28T15:17:56","modified_gmt":"2020-12-28T07:17:56","slug":"%e8%af%b7%e6%95%99%e5%90%84%e4%bd%8d%e5%90%b4%e5%bd%a6%e7%a5%96%e4%b8%80%e4%b8%aa%e9%97%ae%e9%a2%98%e5%90%8c%e4%b8%80%e4%b8%aa-sql-java-%e5%92%8c-plsql-%e7%9a%84%e6%9f%a5%e8%af%a2%e7%bb%93%e6%9e%9c","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=238010","title":{"rendered":"\u8bf7\u6559\u5404\u4f4d\u5434\u5f66\u7956\u4e00\u4e2a\u95ee\u9898:\u540c\u4e00\u4e2a SQL, Java \u548c plsql \u7684\u67e5\u8be2\u7ed3\u679c\u4e0d\u4e00\u81f4."},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u5404\u4f4d\u5434\u5f66\u7956\u4e00\u4e2a\u95ee\u9898:\u540c\u4e00\u4e2a SQL, Java \u548c plsql \u7684\u67e5\u8be2\u7ed3\u679c\u4e0d\u4e00\u81f4.               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yveJohn <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<blockquote>\n<p>\u8bf7\u4e0d\u8981\u5410\u69fd\u4f7f\u7528\u7684\u4e0a\u53e4\u6846\u67b6,\u8fd9\u662f\u516c\u53f8\u7684\u5c4e\u5c71\u9879\u76ee,\u5fc5\u987b\u5f97\u7528!!!<\/p>\n<\/blockquote>\n<ul>\n<li>\n<p>\u5f00\u53d1\u73af\u5883:eclipse 2018.09<\/p>\n<\/li>\n<li>\n<p>JDK \u7248\u672c:JDK 1.8.0_181<\/p>\n<\/li>\n<li>\n<p>orm \u6846\u67b6:ibatis 2.3.4<\/p>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e93\u7248\u672c:Oracle 11g<\/p>\n<\/li>\n<\/ul>\n<h2>\u6839\u636e\u767e\u5ea6\u3001\u8c37\u6b4c\u67e5\u8be2\u7684\u89e3\u51b3\u65b9\u6848\u5df2\u6392\u9664\u4ee5\u4e0b\u95ee\u9898:<\/h2>\n<ol>\n<li>\u7a0b\u5e8f\u548c plsql \u8fde\u63a5\u7684\u6570\u636e\u6e90\u4e0d\u4e00\u81f4<\/li>\n<li>plsql \u4e2d\u5b58\u5728\u672a\u63d0\u4ea4\u7684\u6570\u636e<\/li>\n<li>ibatis \u7f13\u5b58\u5bfc\u81f4<\/li>\n<\/ol>\n<p>SQL \u8bed\u53e5\u56e0\u4e3a\u516c\u53f8\u884c\u4e1a\u654f\u611f,\u4e0d\u80fd\u653e\u51fa\u6765\u7ed9\u5927\u5bb6\u770b,\u5927\u6982\u7c7b\u4f3c\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n<pre><code>with TEMP_TABLE AS(  SELECT ITEM_CODE,ITEM_NAM\u00b7\u00b7\u00b7\u00b7\u00b7     FROM TABLE1     WHERE ITEM_CODE = '***'     ORDER BY ITEM_CODE ) SELECT A.ITEM_LVL,A.MARK,B.ITEM_NAM,SUM(A.VALUE) VALUE FROM TABLE2 A LEFT JOIN TEMP_TABLE B ON A.ITEM_CODE = B.ITEM_CODE GROUP BY A.ITEM_LVL,A.MARK,B.ITEM_NAM <\/code><\/pre>\n<p>\u5177\u4f53\u7684\u9519\u8bef\u8868\u73b0\u662f\u7a0b\u5e8f\u4e2d\u67e5\u8be2\u65f6<code>VALUE<\/code>\u59cb\u7ec8\u4e3a 0,\u4f46\u662f\u628a\u7a0b\u5e8f\u6267\u884c\u7684 SQL \u62ff\u5230 plsql \u4e2d\u6267\u884c<code>VALUE<\/code>\u5b58\u5728\u503c<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>11<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4776381\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : huntcool001 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Mysql \u6709 general log, PQ \u5e94\u8be5\u4e5f\u6709\u7c7b\u4f3c\u7684\u4e1c\u897f. \u76f4\u63a5\u8fde\u4e0a\u670d\u52a1\u7aef\u770b\u65e5\u5fd7,\u770b\u4f60\u7684\u4ee3\u7801\u5ba2\u6237\u7aef\u53d1\u8fc7\u6765\u7684\u67e5\u8be2\u8bed\u53e5\u662f\u4ec0\u4e48.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776382\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             value \u662f\u5173\u952e\u8bcd\uff0c\u7528&#8220;\u5305\u4e00\u4e0b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776383\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lordofhollows <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u80fd\u662f\u56e0\u4e3a\u6709 value \u4e3a null \u7684\u8bb0\u5f55\uff0c\u53ef\u4ee5\u8bd5\u4e0b\uff1asum(nvl(a.value, 0))                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776384\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yveJohn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xuanbg \u53ea\u662f\u4e2a\u4f8b\u5b50\uff0c\u5b9e\u9645\u4e0a\u4e0d\u662f value<\/p>\n<p>@lordofhollows value \u8fd9\u4e2a\u503c\u6ca1\u6709\u7a7a\u6570\u636e\uff0c\u800c\u4e14\u5982\u679c\u662f value \u5b58\u5728 null \u6570\u636e\uff0c\u4e3a\u4ec0\u4e48 plsql \u80fd\u67e5\u8be2\u51fa\u6b63\u786e\u7ed3\u679c\u5462\uff1f<br \/>@huntcool001 \u662f\u4e2a\u597d\u601d\u8def\uff0c\u6211\u73b0\u5728 oracle \u7684\u65e5\u5fd7\u770b\u80fd\u4e0d\u80fd\u627e\u5230\u539f\u56e0\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776385\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tikazyq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u5565\u4e0d\u662f\u5218\u5fb7\u534e\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776386\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tutou <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @tikazyq \u56e0\u4e3a\u5f66\u7956\u4e5f\u79c3\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776387\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yveJohn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @tikazyq #5 \u95ee\u9898\u80fd\u89e3\u51b3\u4f60\u5c31\u662f\u6211\u5fc3\u4e2d\u7684\u5218\u5929\u738b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776388\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yveJohn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @tutou #6 \u522b\u8bf4\u771f\u8bdd!!!                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776389\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cyrivlclth <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u672c\u5434\u5f66\u7956\u63d0\u4f9b\u4e00\u4e2a\u601d\u8def,\u4e0a\u6b21\u67d0\u4eba\u9047\u5230\u8fd9\u4e2a\u95ee\u9898\u662f\u65f6\u533a\u7684\u539f\u56e0&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776390\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hodur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e0a\u6b21\u9047\u5230\u8fd9\u6837\u7684\u95ee\u9898\u662f\u56e0\u4e3a\u5b57\u6bb5\u6620\u5c04\u9519\u8bef\uff0c\u5728 SUM(A.VALUE) \u52a0\u4e2a alias \u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4776391\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : yveJohn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hodur #10 \u5df2\u9a8c\u8bc1\u4e0d\u662f\u8fd9\u4e2a\u95ee\u9898.<br \/>@cyrivlclth #9 \u65f6\u533a\u95ee\u9898\u9876\u591a\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4,\u800c\u4e0d\u4f1a\u5bfc\u81f4\u6570\u636e\u59cb\u7ec8\u4e3a 0 \u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u5404\u4f4d\u5434\u5f66\u7956\u4e00\u4e2a\u95ee\u9898:\u540c\u4e00\u4e2a S&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/238010"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=238010"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/238010\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=238010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=238010"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=238010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}