{"id":15716,"date":"2023-12-04T22:00:59","date_gmt":"2023-12-04T14:00:59","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=15716"},"modified":"2023-12-04T22:01:51","modified_gmt":"2023-12-04T14:01:51","slug":"oracle-zhong-delete-yu-truncate-qu-bie","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/04\/oracle-zhong-delete-yu-truncate-qu-bie\/","title":{"rendered":"Oracle \u4e2d delete \u4e0e Truncate \u533a\u522b\uff1f"},"content":{"rendered":"<p>\u5728 Oracle \u4e2d\uff0c<code>DELETE<\/code> \u548c <code>TRUNCATE<\/code> \u662f\u7528\u4e8e\u5220\u9664\u8868\u6570\u636e\u7684\u4e24\u79cd\u4e0d\u540c\u7684\u8bed\u53e5\uff0c\u5b83\u4eec\u6709\u4ee5\u4e0b\u4e3b\u8981\u533a\u522b\uff1a<\/p>\n<ol>\n<li><strong>DELETE\uff1a<\/strong>\n<ul>\n<li><code>DELETE<\/code> \u8bed\u53e5\u7528\u4e8e\u5220\u9664\u8868\u4e2d\u7684\u884c\uff0c\u53ef\u4ee5\u6839\u636e\u6761\u4ef6\u9009\u62e9\u6027\u5730\u5220\u9664\u6570\u636e\u3002\u5b83\u662f DML\uff08\u6570\u636e\u64cd\u7eb5\u8bed\u8a00\uff09\u7684\u4e00\u90e8\u5206\uff0c\u662f\u4e00\u79cd\u8f83\u4e3a\u7075\u6d3b\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u4f7f\u7528 WHERE \u5b50\u53e5\u6765\u6307\u5b9a\u5220\u9664\u7684\u6761\u4ef6\u3002<\/li>\n<li><code>DELETE<\/code> \u64cd\u4f5c\u4f1a\u4ea7\u751f\u56de\u6eda\u65e5\u5fd7\uff0c\u53ef\u4ee5\u5728\u4e8b\u52a1\u63d0\u4ea4\u524d\u56de\u6eda\u5df2\u5220\u9664\u7684\u6570\u636e\u3002\u5b83\u4f1a\u89e6\u53d1\u76f8\u5173\u7684\u89e6\u53d1\u5668\uff0c\u5e76\u4e14\u53ef\u4ee5\u642d\u914d\u4f7f\u7528 COMMIT \u548c ROLLBACK \u8fdb\u884c\u7ba1\u7406\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-sql  line-numbers\">DELETE FROM table_name WHERE condition;\n<\/code><\/pre>\n<\/li>\n<li><strong>TRUNCATE\uff1a<\/strong>\n<ul>\n<li><code>TRUNCATE<\/code> \u8bed\u53e5\u7528\u4e8e\u5feb\u901f\u5220\u9664\u8868\u4e2d\u7684\u6240\u6709\u6570\u636e\uff0c\u5b83\u662f DDL\uff08\u6570\u636e\u5b9a\u4e49\u8bed\u8a00\uff09\u7684\u4e00\u90e8\u5206\u3002\u4e0e <code>DELETE<\/code> \u4e0d\u540c\uff0c<code>TRUNCATE<\/code> \u662f\u4e00\u79cd\u76f4\u63a5\u64cd\u4f5c\uff0c\u4e0d\u662f\u9010\u884c\u5220\u9664\uff0c\u800c\u662f\u76f4\u63a5\u5220\u9664\u6574\u4e2a\u8868\u7684\u6570\u636e\u3002<\/li>\n<li><code>TRUNCATE<\/code> \u64cd\u4f5c\u4e0d\u4f1a\u4ea7\u751f\u56de\u6eda\u65e5\u5fd7\uff0c\u6240\u4ee5\u65e0\u6cd5\u56de\u6eda\u5df2\u5220\u9664\u7684\u6570\u636e\u3002\u5b83\u901a\u5e38\u6bd4 <code>DELETE<\/code> \u66f4\u5feb\uff0c\u56e0\u4e3a\u5b83\u662f\u4e00\u4e2a\u76f4\u63a5\u7684\u64cd\u4f5c\uff0c\u4e0d\u8bb0\u5f55\u6bcf\u4e00\u884c\u7684\u5220\u9664\u64cd\u4f5c\uff0c\u800c\u662f\u91ca\u653e\u8868\u6240\u5360\u7528\u7684\u7a7a\u95f4\uff0c\u5e76\u5c06\u8868\u91cd\u7f6e\u4e3a\u521d\u59cb\u72b6\u6001\u3002<\/li>\n<li><code>TRUNCATE<\/code> \u4f1a\u5c06\u8868\u7684\u8ba1\u6570\u5668\u91cd\u7f6e\uff0c\u4f46\u4e0d\u4f1a\u89e6\u53d1\u76f8\u5173\u7684\u89e6\u53d1\u5668\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-sql  line-numbers\">TRUNCATE TABLE table_name;\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u603b\u7684\u6765\u8bf4\uff0c<code>DELETE<\/code> \u7528\u4e8e\u6709\u6761\u4ef6\u5730\u5220\u9664\u8868\u7684\u90e8\u5206\u6570\u636e\uff0c\u5e76\u4e14\u53ef\u4ee5\u56de\u6eda\u64cd\u4f5c\uff0c\u800c <code>TRUNCATE<\/code> \u7528\u4e8e\u5feb\u901f\u5220\u9664\u6574\u4e2a\u8868\u7684\u6570\u636e\uff0c\u5e76\u4e14\u4e0d\u4f1a\u4ea7\u751f\u56de\u6eda\u65e5\u5fd7\u3002\u4f7f\u7528\u65f6\u9700\u8981\u6839\u636e\u9700\u6c42\u548c\u9884\u671f\u7684\u6548\u679c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Oracle \u4e2d\uff0cDELETE \u548c TRUNCATE \u662f\u7528\u4e8e\u5220\u9664\u8868\u6570\u636e\u7684\u4e24\u79cd\u4e0d\u540c\u7684\u8bed\u53e5\uff0c\u5b83\u4eec\u6709\u4ee5\u4e0b\u4e3b\u8981\u533a\u522b [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[120],"tags":[],"class_list":["post-15716","post","type-post","status-publish","format-standard","hentry","category-oracel"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/15716","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=15716"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/15716\/revisions"}],"predecessor-version":[{"id":15717,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/15716\/revisions\/15717"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=15716"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=15716"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=15716"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}