{"id":5019,"date":"2024-11-14T10:05:49","date_gmt":"2024-11-14T02:05:49","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5019\/"},"modified":"2024-11-14T10:05:49","modified_gmt":"2024-11-14T02:05:49","slug":"oracle%e6%80%8e%e4%b9%88%e4%b8%bb%e9%94%ae%e8%87%aa%e5%a2%9e","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5019\/","title":{"rendered":"oracle\u600e\u4e48\u4e3b\u952e\u81ea\u589e"},"content":{"rendered":"<blockquote><p>\n  oracle \u4e2d\u53ef\u901a\u8fc7\u5e8f\u5217\u6216\u81ea\u589e\u5217\u5b9e\u73b0\u5217\u503c\u81ea\u589e\uff0c\u5177\u4f53\u5982\u4e0b\uff1a\u5e8f\u5217\uff1a\u521b\u5efa\u5e8f\u5217\u5e76\u6307\u5b9a\u8d77\u59cb\u503c\u548c\u589e\u91cf\uff0c\u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u5e8f\u5217\u540d\uff0c\u4f7f\u5176\u81ea\u589e\uff1b\u81ea\u589e\u5217\uff1a\u76f4\u63a5\u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u81ea\u589e\u5217\uff0c\u53ef\u6307\u5b9a\u8d77\u59cb\u503c\u548c\u589e\u91cf\uff08oracle 12c \u53ca\u66f4\u9ad8\u7248\u672c\uff09\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/21\/2024052110571561539.jpg\" class=\"aligncenter\" title=\"oracle\u600e\u4e48\u4e3b\u952e\u81ea\u589e\u63d2\u56fe\" alt=\"oracle\u600e\u4e48\u4e3b\u952e\u81ea\u589e\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f7f Oracle \u4e2d\u7684\u5217\u4e3b\u952e\u81ea\u589e<\/strong><\/p>\n<p>\u5728 Oracle \u6570\u636e\u5e93\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5e8f\u5217\u6216\u81ea\u589e\u5217\u4f7f\u5217\u503c\u81ea\u52a8\u9012\u589e\u3002\u4ee5\u4e0b\u662f\u4e24\u79cd\u65b9\u6cd5\uff1a<\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u4f7f\u7528\u5e8f\u5217<\/strong><\/p>\n<ol>\n<li>\n<p>\u521b\u5efa\u4e00\u4e2a\u5e8f\u5217\uff1a<\/p>\n<pre>CREATE SEQUENCE &lt;\u5e8f\u5217\u540d&gt; START WITH &lt;\u8d77\u59cb\u503c&gt; INCREMENT BY &lt;\u589e\u91cf&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p>\u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u5e8f\u5217\uff1a<\/p>\n<pre>CREATE TABLE &lt;\u8868\u540d&gt; (\n  id NUMBER PRIMARY KEY DEFAULT &lt;\u5e8f\u5217\u540d&gt;.NEXTVAL\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ol>\n<p><strong>\u65b9\u6cd5 2\uff1a\u4f7f\u7528\u81ea\u589e\u5217<\/strong><\/p>\n<ol>\n<li>\u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u81ea\u589e\u5217\uff1a<\/li>\n<\/ol>\n<p>\u5bf9\u4e8e Oracle 12c \u4e4b\u524d\u7684\u7248\u672c\uff1a<\/p>\n<pre>CREATE TABLE &lt;\u8868\u540d&gt; (\n  id NUMBER GENERATED ALWAYS AS IDENTITY\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5bf9\u4e8e Oracle 12c \u53ca\u66f4\u9ad8\u7248\u672c\uff1a<\/p>\n<pre>CREATE TABLE &lt;\u8868\u540d&gt; (\n  id NUMBER GENERATED BY DEFAULT AS IDENTITY\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\n<p>\u6307\u5b9a\u8d77\u59cb\u503c\uff08\u53ef\u9009\uff09\uff1a<\/p>\n<pre>CREATE TABLE &lt;\u8868\u540d&gt; (\n  id NUMBER GENERATED BY DEFAULT AS IDENTITY (START WITH &lt;\u8d77\u59cb\u503c&gt;)\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p>\u6307\u5b9a\u589e\u91cf\uff08\u53ef\u9009\uff09\uff1a<\/p>\n<pre>CREATE TABLE &lt;\u8868\u540d&gt; (\n  id NUMBER GENERATED BY DEFAULT AS IDENTITY (INCREMENT BY &lt;\u589e\u91cf&gt;)\n);<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u4e3b\u952e\u81ea\u589e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>oracle \u4e2d\u53ef\u901a\u8fc7\u5e8f\u5217\u6216\u81ea\u589e\u5217\u5b9e\u73b0\u5217\u503c\u81ea\u589e\uff0c\u5177\u4f53\u5982\u4e0b\uff1a\u5e8f\u5217\uff1a\u521b\u5efa\u5e8f\u5217\u5e76\u6307\u5b9a\u8d77\u59cb\u503c\u548c\u589e\u91cf\uff0c\u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u5e8f\u5217\u540d\uff0c\u4f7f\u5176\u81ea\u589e\uff1b\u81ea\u589e\u5217\uff1a\u76f4\u63a5\u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u81ea\u589e\u5217\uff0c\u53ef\u6307\u5b9a\u8d77\u59cb\u503c\u548c\u589e\u91cf\uff08oracle 12c \u53ca\u66f4\u9ad8\u7248\u672c\uff09\u3002 \u5982\u4f55\u4f7f Oracle \u4e2d\u7684\u5217\u4e3b\u952e\u81ea\u589e \u5728 Oracle \u6570\u636e\u5e93\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u5e8f\u5217\u6216\u81ea\u589e\u5217\u4f7f\u5217\u503c\u81ea\u52a8\u9012\u589e\u3002\u4ee5\u4e0b\u662f\u4e24\u79cd\u65b9\u6cd5\uff1a \u65b9\u6cd5 1\uff1a\u4f7f\u7528\u5e8f\u5217 \u521b\u5efa\u4e00\u4e2a\u5e8f\u5217\uff1a CREATE SEQUENCE &lt;\u5e8f\u5217\u540d&gt; START WITH &lt;\u8d77\u59cb\u503c&gt; INCREMENT BY &lt;\u589e\u91cf&gt; \u767b\u5f55\u540e\u590d\u5236 \u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u5e8f\u5217\uff1a CREATE TABLE &lt;\u8868\u540d&gt; ( id NUMBER PRIMARY KEY DEFAULT &lt;\u5e8f\u5217\u540d&gt;.NEXTVAL ); \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 2\uff1a\u4f7f\u7528\u81ea\u589e\u5217 \u5728\u521b\u5efa\u8868\u65f6\u6307\u5b9a\u81ea\u589e\u5217\uff1a \u5bf9\u4e8e Oracle 12c \u4e4b\u524d\u7684\u7248\u672c\uff1a CREATE TABLE &lt;\u8868\u540d&gt; ( id NUMBER GENERATED ALWAYS AS IDENTITY ); \u767b\u5f55\u540e\u590d\u5236 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5019","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5019"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5019\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}