{"id":1218,"date":"2019-06-19T09:19:20","date_gmt":"2019-06-19T01:19:20","guid":{"rendered":"http:\/\/www.hefeiyu.com\/?p=1218"},"modified":"2022-07-16T16:18:25","modified_gmt":"2022-07-16T08:18:25","slug":"%e5%b8%b8%e7%94%a8oracle-sql%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.hefeiyu.com\/?p=1218","title":{"rendered":"\u5e38\u7528ORACLE SQL\u8bb0\u5f55"},"content":{"rendered":"<p>\u4e00\u884c\u62c6\u6210\u591a\u5217\/\u4e00\u884c\u8f6c\u591a\u5217\/\u4e00\u884c\u8f6c\u6210\u591a\u884c\/\u4e00\u884c\u62c6\u6210\u591a\u884c\uff1a<\/p>\n<p>select regexp_substr(&#8216;1:a,2:b,3:c&#8217;, &#8216;[^,]+&#8217;, 1, level) col from dual connect by level &lt;= regexp_count(&#8216;1:a,2:b,3:c&#8217;, &#8216;\\,&#8217;) + 1<\/p>\n<p>\u6309\u9017\u53f7\u62c6\u5206\u5b57\u4e32\/\u4e00\u884c\u8f6c\u6210\u591a\u884c\uff1aWITH TMP_TAB as (SELECT &#8216;15,13,12,15,16,41,13,16&#8217; as id,ROWNUM FROM dual) SELECT ROWNUM,max(id),COUNT(id) FROM (SELECT REGEXP_SUBSTR(id, &#8216;[^,]+&#8217;, 1, ROWNUM) as id FROM TMP_TAB CONNECT BY ROWNUM &lt;= length(id) &#8211; length(replace(id, &#8216;,&#8217;, &#8221;)) + 1) GROUP BY ROWNUM ORDER BY ROWNUM<\/p>\n<p>\u628a\u6570\u636e\u5e93\u91cc\u9762\u7684\u67d0\u4e2a\u5b57\u6bb5\u8fdb\u884c\u591a\u884c\u5e76\u5408\uff1a SELECT to_char(WM_CONCAT(pmd02)) FROM pmd_file WHERE pmd01=&#8217;110009&#8242;<\/p>\n<p>\u67e5\u6682\u65f6\u8868\u4e2d\u7684\u8868\u540d,\u9700\u8981SYS\u767b\u9646\uff1a select * from dba_objects where object_name like &#8216;% TEMP_CBMR622622%&#8217;<\/p>\n<p>SQL\u4e2d\u542b\u6709\u4e2d\u6587\uff1aselect ima01 from ima_file where asciistr(ima01) like &#8216;%\\%&#8217;;<\/p>\n<p>\u67e5\u770b\u5f53\u524d\u6570\u636e\u7684\u7ec4\u6210\u7c7b\u578b\uff1aSELECT dump(bmb03) FROM bmb_file WHERE bmb03 LIKE &#8216;%518408210043&#8217;<\/p>\n<p>SQLERRD[3]\uff1a\u5904\u7406\u8d44\u6599\u7684\u7b14\u6570\uff1bSQLERRD[2]\uff1a\u65b0\u589e\u65f6 SERIAL \u5b57\u6bb5\u6240\u4f20\u56de\u4e4b\u503c\uff1bSQLERRD[6]\uff1a\u6700\u540e\u4e00\u4e2a ROWID \u503c\uff1bSQLAWARN[1]\uff1a\u82e5\u7b2c\uff12\u81f3\u7b2c\uff18\u5b57\u7b26\u4e2d\u4efb\u610f\u4e00\u4e2a\u88ab\u8bbe\u6210&#8221;W&#8221;\uff0c\u5219\u6b64\u5b57\u7b26\u4ea6\u4e3a &#8220;W&#8221;\uff0c\u5426\u5219\u4e3a\u7a7a\u767d\uff1bSQLAWARN[2]\uff1a\u82e5\u8d44\u6599\u592a\u957f\u800c\u88ab\u622a\u6389\u65f6\uff0c\u4f1a\u88ab\u8bbe\u6210 &#8220;W&#8221;\uff1bSQLAWARN[3]\uff1a\u82e5 aggregate function(\u5982 SUM\uff0cAVG\uff0cMAX\uff0cMIN) \u5904\u7406\u65f6\u9047\u5230 NULL \u503c\uff0c\u5219\u4f1a\u88ab\u8bbe\u6210&#8221;W&#8221;\uff1bSQLAWARN[4]\uff1a\u82e5\u67e5\u8be2\u65f6\uff0c\u82e5\u6b32\u67e5\u8be2\u7684\u5b57\u6bb5\u6570\u76ee\u548c INTO \u4e4b\u53d8\u91cf\u6570\u76ee\u4e0d\u5408\u65f6\uff0c\u4f1a\u88ab\u8bbe\u6210 &#8220;W&#8221;\uff1b\u7528\u6cd5\uff1aif sqlca.sqlerrd[6] then<\/p>\n<p>\u53d6\u6700\u8fd1\u91c7\u8d2d\u5355\u4ef7:<br \/>\nSELECT Max(pmn31) Keep (dense_rank First Order By pmm04 ASC) price_lastt,<br \/>\nMax(pmn31t) Keep (dense_rank First Order By pmm04 ASC) price_last<br \/>\nFROM pmn_file,pmm_file WHERE pmm01=pmn01 AND pmm09=? AND pmn04=? GROUP By pmm09,pmn04<\/p>\n<p>SELECT ZGH,MIN(WM) KEEP(DENSE_RANK FIRST ORDER BY WM), MIN(RQ) KEEP(DENSE_RANK FIRST ORDER BY WM)<br \/>\nFROM T_JZG GROUP BY ZGH<\/p>\n<p>\u5982\u4f55\u53d6\u6570\u636e\u5217\u8868\u4e2d\u7684\u6700\u540e\u4e00\u6761\u8bb0\u5f55(\u5173\u952e\u70b9\u662f\u4e3arownum\u53d6\u522b\u540d)\uff1aselect * from (select rownum rn,table_name.* from table_name)\u00a0 where\u00a0 rn=(select\u00a0 count(*)\u00a0 from\u00a0 table_name)<\/p>\n<p>\u8d4b\u4e88\u516c\u5171\u6743\u9650\u3002GRANT select ON films FROM PUBLIC; \u53d6\u6d88REVOKE select ON films FROM PUBLIC;<\/p>\n<p>\u63a5\u53e3\u95ee\u9898\u5904\u7406\uff1a\u7528tiptop\u767b\u5f55\uff0c\u5148\u627e\u51fa\u8be5\u670d\u52a1 ps -ef|grep as.xcf_84 \uff0ckill\u6389\uff0c\u518d\u91cd\u542f\u3002\u91cd\u542f\u547d\u4ee4\uff1astartws\uff08\u5df2\u8bbe\u7f6e\u81ea\u52a8\uff09<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"https:\/\/www.hefeiyu.com\">\u8d6b\u975e\u57df<\/a> &raquo; <a href=\"https:\/\/www.hefeiyu.com\/?p=1218\">\u5e38\u7528ORACLE SQL\u8bb0\u5f55<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e00\u884c\u62c6\u6210\u591a\u5217\/\u4e00\u884c\u8f6c\u591a\u5217\/\u4e00\u884c\u8f6c\u6210\u591a\u884c\/\u4e00\u884c\u62c6\u6210\u591a\u884c\uff1a select regexp_substr(&#8216;1:a,2:b,3:c&#8217;, &#8216;[^,]+&#8217;, 1, level) col from dual conn [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[430,429,428],"class_list":["post-1218","post","type-post","status-publish","format-standard","hentry","category-unix","tag-level","tag-regexp","tag-select"],"_links":{"self":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1218"}],"version-history":[{"count":4,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1218\/revisions"}],"predecessor-version":[{"id":8617,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=\/wp\/v2\/posts\/1218\/revisions\/8617"}],"wp:attachment":[{"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hefeiyu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}