{"id":2265,"date":"2024-03-27T23:31:48","date_gmt":"2024-03-27T15:31:48","guid":{"rendered":"https:\/\/coderbee.net\/?p=2265"},"modified":"2024-03-27T23:54:38","modified_gmt":"2024-03-27T15:54:38","slug":"oracle-%e7%bb%91%e5%ae%9a%e5%8f%98%e9%87%8f%e8%bf%87%e5%a4%9a%e5%af%bc%e8%87%b4-dml-%e9%98%bb%e5%a1%9e","status":"publish","type":"post","link":"https:\/\/coderbee.net\/index.php\/db\/20240327\/2265","title":{"rendered":"Oracle \u7ed1\u5b9a\u53d8\u91cf\u8fc7\u591a\u5bfc\u81f4 DML \u963b\u585e"},"content":{"rendered":"<p>\u751f\u4ea7\u6709\u4e2a\u529f\u80fd\u662f\u4e0a\u4f20\u4e00\u4e2a excel \u6765\u8fdb\u884c\u6279\u91cf\u6570\u636e\u64cd\u4f5c\uff0cexcel \u91cc\u9762\u6709\u4e09\u5217\u6570\u636e\uff0c\u6784\u5efa\u51fa\u6765\u7684\u67e5\u8be2\u5927\u6982\u5982\u4e0b\uff1a<br \/>\n<code><br \/>\nselect * from t_test t where (t.col1, t.col2, t.col3) in (<br \/>\n(:1, :2, :3),<br \/>\n(:4, :5, :6)<br \/>\n)<br \/>\n<\/code><br \/>\nIN \u5b50\u53e5\u7684\u957f\u5ea6\u53d6\u51b3\u4e8e\u4e0a\u4f20\u7684 excel \u91cc\u7684\u884c\u6570\uff0c\u6bcf\u4e00\u884c\u5bf9\u5e94\u4e00\u4e2a \u5143\u7ec4\u3002<br \/>\n<\/code><br \/>\n\u7531\u4e8e\u6ca1\u6709\u9650\u5236 excel \u91cc\u6700\u5927\u884c\u6570\uff0c\u5bfc\u81f4\u6784\u5efa\u51fa\u6765\u7684 SQL \u67091\u4e07\u591a\u4e2a\u7ed1\u5b9a\u53d8\u91cf\uff0c\u7136\u540e\u8fd9\u4e2a SQL \u4e00\u76f4\u5904\u4e8e\u89e3\u6790\u4e2d\uff0c\u963b\u585e\u4e86\u8fd9\u4e2a\u8868\u4e0a\u7684\u5176\u4ed6\u64cd\u4f5c\uff08\u5f53\u65f6\u4e3b\u8981\u662f\u63d2\u5165\u64cd\u4f5c\uff09\u3002\uff08DBA \u8054\u7cfb\u5382\u5546\u5206\u6790\u7ed9\u51fa\u7684\u7ed3\u8bba\uff09<\/p>\n<p>\u4e4b\u524d\u4e00\u76f4\u4ee5\u4e3a IN \u7684\u5217\u8868\u4e0d\u80fd\u8d85\u8fc7 1000\uff0c\u90a3\u4e48\u751f\u4ea7\u4e3a\u4ec0\u4e48\u6ca1\u6709\u62a5\u9519\uff0c\u5f53\u65f6\u62ff\u4e86\u90a3\u4e2a\u5f15\u53d1\u95ee\u9898\u7684 excel \u6587\u4ef6\u5728\u6d4b\u8bd5\u73af\u5883\u590d\u73b0\uff0c\u662f\u53ef\u4ee5\u6b63\u5e38\u6267\u884c\u5b8c\u6210\u7684\u3002<br \/>\nDBA \u7684\u89e3\u91ca\u662f 11g \u91cc\u4e0d\u4f1a\u62a5\u9519\uff0c19c \u5f00\u59cb\u4f1a\u62a5\u9519\u3002DBA \u53e6\u5916\u63d0\u5230 IN \u5217\u8868\u8fc7\u957f\u7684\u6267\u884c\u6548\u7387\u662f\u4e0d\u9ad8\u7684\uff0cIN \u5217\u8868\u6bcf\u591a\u4e00\u884c\uff0c\u6267\u884c\u8ba1\u5212 UNION ALL \u4e0b\u4e5f\u591a\u4e00\u884c\uff1a<br \/>\n<img decoding=\"async\" src=\"https:\/\/coderbee.net\/wp-content\/uploads\/2024\/03\/union-all.png\" \/><\/p>\n<p>\u4eca\u5929\u91cd\u65b0\u63d0\u8d77\u8fd9\u4e2a\uff0c\u6709\u540c\u4e8b\u5199\u4e86\u4e2a SQL \u5728\u672c\u5730\u9a8c\u8bc1\u662f\u62a5\u9519\u7684\uff1a<br \/>\n<code><br \/>\nselect * from t_test t where t.col1 in (1, 2, 3, ..., 1001);<br \/>\n<\/code><\/p>\n<p>\u4e3a\u5565\u5f53\u65f6\u6d4b\u8bd5\u73af\u5883\u590d\u73b0\u901a\u8fc7\uff0c\u8fd9\u4e2a\u4e3a\u5565\u62a5\u9519\uff1f\u5fc5\u987b\u641e\u6e05\u695a\u4e86\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u539f\u56e0\u5982\u4e0b\uff1a<br \/>\n<a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/12.2\/sqlrf\/Expression-Lists.html#GUID-5CC8FC75-813B-44AA-8737-D940FA887D1E\" rel=\"noopener\" target=\"_blank\">https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/12.2\/sqlrf\/Expression-Lists.html#GUID-5CC8FC75-813B-44AA-8737-D940FA887D1E<\/a><\/p>\n<blockquote><p>\nA comma-delimited list of expressions can contain no more than 1000 expressions. A comma-delimited list of sets of expressions can contain any number of sets, but each set can contain no more than 1000 expressions.<br \/>\n\u7528\u9017\u53f7\u5206\u9694\u7684\u8868\u8fbe\u5f0f\u5217\u8868\u4e2d\u4e0d\u80fd\u5305\u542b\u8d85\u8fc71000\u4e2a\u8868\u8fbe\u5f0f\u3002\u7528\u9017\u53f7\u5206\u9694\u7684\u8868\u8fbe\u5f0f\u96c6\u5408\u5217\u8868\u53ef\u4ee5\u5305\u542b\u4efb\u610f\u6570\u91cf\u7684\u96c6\u5408\uff0c\u4f46\u6bcf\u4e2a\u96c6\u5408\u4e0d\u80fd\u5305\u542b\u8d85\u8fc71000\u4e2a\u8868\u8fbe\u5f0f\u3002\n<\/p><\/blockquote>\n<p>\u987a\u4fbf\u72d7\u5230\u4e86 IN \u600e\u4e48\u8d85\u8fc7 1000 \u7684\u65b9\u6cd5\uff1a<br \/>\n<code><br \/>\nselect * from worktracker<br \/>\nwhere  rmid in ( 1, ..., 999 )<br \/>\nor  rmid in ( 1001, ..., 1999 )<br \/>\nor ...<\/p>\n<p>select * from worktracker<br \/>\nwhere  ( 1, rmid ) in (<br \/>\n  ( 1, '1001' ),<br \/>\n  ( 1, '1212' ),<br \/>\n  ...<br \/>\n)<br \/>\n<\/code><\/p>\n<hr \/>\n<p>\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u5fae\u4fe1\u516c\u4f17\u53f7: <strong>coderbee\u7b14\u8bb0<\/strong> \u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"258\" height=\"258\" src=\"https:\/\/coderbee.net\/wp-content\/uploads\/2019\/01\/coderbee-note.jpg\" class=\"alignnone size-full wp-image-1707\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u751f\u4ea7\u6709\u4e2a\u529f\u80fd\u662f\u4e0a\u4f20\u4e00\u4e2a excel \u6765\u8fdb\u884c\u6279\u91cf\u6570\u636e\u64cd\u4f5c\uff0cexcel \u91cc\u9762\u6709\u4e09\u5217\u6570 &hellip; <a href=\"https:\/\/coderbee.net\/index.php\/db\/20240327\/2265\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[362],"_links":{"self":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/2265"}],"collection":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/comments?post=2265"}],"version-history":[{"count":11,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/2265\/revisions"}],"predecessor-version":[{"id":2273,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/posts\/2265\/revisions\/2273"}],"wp:attachment":[{"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/media?parent=2265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/categories?post=2265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderbee.net\/index.php\/wp-json\/wp\/v2\/tags?post=2265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}