{"id":209865,"date":"2022-08-21T03:04:34","date_gmt":"2022-08-20T19:04:34","guid":{"rendered":"https:\/\/www.keaglegz.com\/209865.html"},"modified":"2026-07-15T06:58:18","modified_gmt":"2026-07-14T22:58:18","slug":"ora-02270-%e6%ad%a4%e5%88%97%e5%88%97%e8%a1%a8%e7%9a%84%e5%94%af%e4%b8%80%e5%85%b3%e9%94%ae%e5%ad%97%e6%88%96%e4%b8%bb%e9%94%ae%e4%b8%8d%e5%8c%b9%e9%85%8d%e4%b8%80%e4%ba%9b","status":"publish","type":"post","link":"https:\/\/www.dongwubaike.cn\/fanhao\/209865.html","title":{"rendered":"ORA-02270: \u6b64\u5217\u5217\u8868\u7684\u552f\u4e00\u5173\u952e\u5b57\u6216\u4e3b\u952e\u4e0d\u5339\u914d\u4e00\u4e9b"},"content":{"rendered":"\n<p><strong>ORA-02270: \u6b64\u5217\u5217\u8868\u7684\u552f\u4e00\u5173\u952e\u5b57\u6216\u4e3b\u952e\u4e0d\u5339\u914d\u4e00\u4e9b\u601d\u8def<\/strong><\/p>\n<p>\u67e5\u770b\u4e24\u4e2a\u8868\u7684\u7ed3\u6784<\/p>\n<p>SQL&gt; describe student;<\/p>\n<p>Name &nbsp; &nbsp; &nbsp; &nbsp; Type &nbsp; &nbsp; &nbsp; &nbsp; Nullable Default Comments&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;- &#8212;&#8212;&#8211;&nbsp;<\/p>\n<p>ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NUMBER(10) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n<p>TEACHER_ID &nbsp; NUMBER(10) &nbsp; Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n<p>STUDENT_NAME VARCHAR2(20) Y &nbsp; &nbsp; &nbsp; &nbsp;&#8216;\u55ef\u55ef\u55ef&#8217; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p>SAL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;NUMBER(20) &nbsp; Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n<p>SEX &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;VARCHAR2(2) &nbsp;Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n<p>&nbsp;<\/p>\n<p>SQL&gt; describe teacher;<\/p>\n<p>Name &nbsp; &nbsp; &nbsp; &nbsp; Type &nbsp; &nbsp; &nbsp; &nbsp; Nullable Default Comments&nbsp;<\/p>\n<p>&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211; &#8212;&#8212;- &#8212;&#8212;&#8211;&nbsp;<\/p>\n<p>ID &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NUMBER(10) &nbsp; Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n<p>TEACHER_NAME VARCHAR2(20) Y &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/p>\n<p>&nbsp;<\/p>\n<p>\u67e5\u770b\u4e24\u4e2a\u8868\u7ea6\u675f\u57fa\u672c\u4fe1\u606f<\/p>\n<p>SQL&gt; select table_name,constraint_name,constraint_type,status from user_constraints where table_name=&#8217;TEACHER&#8217;;<\/p>\n<p>TABLE_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONSTRAINT_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CONSTRAINT_TYPE STATUS<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211;<\/p>\n<p>TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TEACHER2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; P &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DISABLED<\/p>\n<p>TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;C &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ENABLED<\/p>\n<p>TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UQ_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;U &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ENABLED<\/p>\n<p>&nbsp;<\/p>\n<p>SQL&gt; select table_name,constraint_name,constraint_type,status from user_constraints where table_name=&#8217;STUDENT&#8217;;<\/p>\n<p>TABLE_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONSTRAINT_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CONSTRAINT_TYPE STATUS<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8211;<\/p>\n<p>STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CHK_STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;C &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ENABLED<\/p>\n<p>STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PK_STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; P &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ENABLED<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u67e5\u770b\u7ea6\u675f\u5efa\u7acb\u90a3\u4e9b\u5217\u7ed3\u6784<\/p>\n<p>SQL&gt; select table_name,constraint_name,column_name from user_cons_columns where table_name=&#8217;TEACHER&#8217;;<\/p>\n<p>TABLE_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONSTRAINT_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN_NAME<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;UQ_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TEACHER_NAME<\/p>\n<p>TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TEACHER2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ID<\/p>\n<p>TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TEACHER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ID<\/p>\n<p>&nbsp;<\/p>\n<p>SQL&gt; select table_name,constraint_name,column_name from user_cons_columns where table_name=&#8217;STUDENT&#8217;;<\/p>\n<p>TABLE_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CONSTRAINT_NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;COLUMN_NAME<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PK_STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ID<\/p>\n<p>STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CHK_STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SAL<\/p>\n<p>STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CHK_STUDENT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SEX<\/p>\n<p>\u5173\u8054\u4e24\u4e2a\u8868\u7684id\u53f7\u7684\u65f6\u5019\u62a5\u9519<\/p>\n<p>SQL&gt; alter table student add constraint fk_student foreign key (TEACHER_ID) references teacher (ID);<\/p>\n<p>alter table student add constraint fk_student foreign key (TEACHER_ID) references teacher (ID)<\/p>\n<p><strong><span style=\"color: #c00000\">ORA-02270: \u6b64\u5217\u5217\u8868\u7684\u552f\u4e00\u5173\u952e\u5b57\u6216\u4e3b\u952e\u4e0d\u5339\u914d<\/span><\/strong><\/p>\n<p>\u89e3\u51b3\u601d\u8def<\/p>\n<p>1\u3001\u67e5\u770b\u7ed1\u5b9a\u4e3b\u952e\u4e0e\u5916\u952e\u6570\u636e\u7c7b\u578b\u4e0d\u540c\uff08\u6570\u636e\u662f\u5426\u76f8\u540c\uff09<\/p>\n<p>2\u3001\u67e5\u770b\u4e3b\u952e\u662f\u5426\u8fd8\u6709\u5176\u4ed6\u7ea6\u675f\uff08\u5916\u952e\u8c8c\u4f3c\u53ea\u80fd\u7ed1\u5b9a\u4e3b\u952e\uff09\uff0c\u662f\u5426\u8fd8\u6709\u5176\u4ed6\u7684\u68c0\u6d4b\u7ea6\u675f\u7b49\u7b49<\/p>\n<p>3\u3001\u8ba4\u771f\u89c2\u5bdf\u4ed4\u7ec6\uff0c\u952e\u503c\u7684\u72b6\u6001\u662f\u5426\u5f00\u542f\uff01<\/p>\n<p>\u672c\u9898\u603b\u7ed3<\/p>\n<p>\u56e0\u4e3a\u7b2c\u4e00\u5f20\u8868\u4e3b\u952e\u7ea6\u675f\u88ab\u5173\u95ed\uff0c\u6240\u4ee5\u5bfc\u81f4\u5916\u952e\u6b63\u5e38\u8fde\u63a5\uff0c\u5c0f\u9519\u8bef\u51b3\u6210\u8d25\u3002<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4<\/p>\n<p>SQL&gt; alter table teacher modify constraint TEACHER2 ENABLE;<\/p>\n<p>Table altered<\/p>\n<p>SQL&gt; alter table student add constraint fk_student foreign key (TEACHER_ID) references teacher (ID);<\/p>\n<p>Table altered<\/p>\n<p>\u5173\u8054\u6210\u529f\uff01<\/p>\n<p><span><span style=\"color: #ff0000\">\u66f4\u591aOracle\u76f8\u5173\u4fe1\u606f\u89c1<\/span><span style=\"color: #0000ff\">Oracle<\/span><span style=\"color: #ff0000\"> \u4e13\u9898\u9875\u9762 <\/span><span style=\"color: #0000ff\">http:\/\/www.linuxidc.com\/topicnews.aspx?tid=12<\/span><\/span><\/p>\n<p><span style=\"font-size: small\"><strong>\u672c\u6587\u6c38\u4e45\u66f4\u65b0\u94fe\u63a5\u5730\u5740<\/strong><\/span>\uff1ahttp:\/\/www.linuxidc.com\/Linux\/2018-01\/150058.htm<\/p>\n<p><a href=\"https:\/\/www.dongwubaike.cn\/fanhao\/wp-content\/uploads\/2024\/06\/hao2022223238.jpg\" data-fancybox=\"images\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dongwubaike.cn\/fanhao\/wp-content\/uploads\/2024\/06\/hao2022223238.jpg\" width=\"15\" height=\"17\" alt=\"ORA-02270: \u6b64\u5217\u5217\u8868\u7684\u552f\u4e00\u5173\u952e\u5b57\u6216\u4e3b\u952e\u4e0d\u5339\u914d\u4e00\u4e9b\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ORA-02270: \u6b64\u5217\u5217\u8868\u7684\u552f\u4e00\u5173\u952e\u5b57\u6216\u4e3b\u952e\u4e0d\u5339\u914d\u4e00\u4e9b\u601d\u8def\u67e5\u770b\u4e24\u4e2a\u8868\u7684\u7ed3\u6784SQL&gt; describe student;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-209865","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/209865","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/comments?post=209865"}],"version-history":[{"count":1,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/209865\/revisions"}],"predecessor-version":[{"id":308316,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/posts\/209865\/revisions\/308316"}],"wp:attachment":[{"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/media?parent=209865"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/categories?post=209865"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dongwubaike.cn\/fanhao\/wp-json\/wp\/v2\/tags?post=209865"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}