{"id":88122,"date":"2024-10-18T06:46:18","date_gmt":"2024-10-17T22:46:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/88122\/"},"modified":"2024-10-18T06:46:19","modified_gmt":"2024-10-17T22:46:19","slug":"ora-23430-%e5%8f%83%e6%95%b8-string-%e4%b8%8d%e8%83%bd%e7%82%ba-null-%e6%88%96%e7%a9%ba%e5%ad%97%e7%ac%a6%e4%b8%b2-oracle-%e5%a0%b1%e9%8c%af-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/88122\/","title":{"rendered":"ORA-23430: \u53c3\u6578 \u201cstring\u201d \u4e0d\u80fd\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32 ORACLE \u5831\u932f \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406"},"content":{"rendered":"<h1 id=\"ora-23430-%e5%8f%83%e6%95%b8-string-%e4%b8%8d%e8%83%bd%e7%82%ba-null-%e6%88%96%e7%a9%ba%e5%ad%97%e7%ac%a6%e4%b8%b2-oracle-%e5%a0%b1%e9%8c%af-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9-YkbvGoCHoE\">ORA-23430: \u53c3\u6578 \u201cstring\u201d \u4e0d\u80fd\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32 ORACLE \u5831\u932f \u6545\u969c\u4fee\u5fa9 \u9060\u7a0b\u8655\u7406<\/h1>\n<p>\u5728\u4f7f\u7528 Oracle \u6578\u64da\u5eab\u7684\u904e\u7a0b\u4e2d\uff0c\u958b\u767c\u8005\u548c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\u4ee3\u78bc\uff0c\u5176\u4e2d\u4e4b\u4e00\u4fbf\u662f <code>ORA-23430<\/code>\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u8868\u793a\u67d0\u500b\u53c3\u6578\u7684\u503c\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\uff0c\u9019\u5728\u57f7\u884c\u67d0\u4e9b\u64cd\u4f5c\u6642\u6703\u5c0e\u81f4\u6578\u64da\u5eab\u7121\u6cd5\u6b63\u5e38\u904b\u884c\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u539f\u56e0\u3001\u5f71\u97ff\u4ee5\u53ca\u5982\u4f55\u9032\u884c\u6545\u969c\u4fee\u5fa9\u3002<\/p>\n<h2 id=\"ora-23430-%e9%8c%af%e8%aa%a4%e7%9a%84%e5%8e%9f%e5%9b%a0-YkbvGoCHoE\">ORA-23430 \u932f\u8aa4\u7684\u539f\u56e0<\/h2>\n<p>\u7576\u4f60\u5728 Oracle \u6578\u64da\u5eab\u4e2d\u57f7\u884c\u67d0\u4e9b\u64cd\u4f5c\u6642\uff0c\u7cfb\u7d71\u6703\u6aa2\u67e5\u6240\u6709\u53c3\u6578\u7684\u6709\u6548\u6027\u3002\u5982\u679c\u67d0\u500b\u53c3\u6578\u88ab\u8a2d\u7f6e\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\uff0c\u5247\u6703\u89f8\u767c <code>ORA-23430<\/code> \u932f\u8aa4\u3002\u9019\u7a2e\u60c5\u6cc1\u901a\u5e38\u767c\u751f\u5728\u4ee5\u4e0b\u5e7e\u7a2e\u60c5\u6cc1\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u5b58\u5132\u904e\u7a0b\u6216\u51fd\u6578\u8abf\u7528\uff1a<\/strong>\u7576\u8abf\u7528\u5b58\u5132\u904e\u7a0b\u6216\u51fd\u6578\u6642\uff0c\u5982\u679c\u50b3\u905e\u7684\u53c3\u6578\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\uff0c\u5247\u6703\u5f15\u767c\u6b64\u932f\u8aa4\u3002<\/li>\n<li><strong>\u6578\u64da\u63d2\u5165\u6216\u66f4\u65b0\u64cd\u4f5c\uff1a<\/strong>\u5728\u9032\u884c\u6578\u64da\u63d2\u5165\u6216\u66f4\u65b0\u6642\uff0c\u5982\u679c\u67d0\u500b\u5fc5\u586b\u5b57\u6bb5\u7684\u503c\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\uff0c\u5247\u6703\u5c0e\u81f4\u932f\u8aa4\u3002<\/li>\n<li><strong>\u89f8\u767c\u5668\u57f7\u884c\uff1a<\/strong>\u5982\u679c\u89f8\u767c\u5668\u4e2d\u4f7f\u7528\u4e86 NULL \u6216\u7a7a\u5b57\u7b26\u4e32\u4f5c\u70ba\u53c3\u6578\uff0c\u4e5f\u53ef\u80fd\u6703\u5f15\u767c\u6b64\u932f\u8aa4\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9-ora-23430-%e9%8c%af%e8%aa%a4-YkbvGoCHoE\">\u5982\u4f55\u4fee\u5fa9 ORA-23430 \u932f\u8aa4<\/h2>\n<p>\u4fee\u5fa9 <code>ORA-23430<\/code> \u932f\u8aa4\u7684\u7b2c\u4e00\u6b65\u662f\u78ba\u5b9a\u662f\u54ea\u500b\u53c3\u6578\u5c0e\u81f4\u4e86\u554f\u984c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u6545\u969c\u6392\u9664\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5%e5%8f%83%e6%95%b8%e5%80%bc-YkbvGoCHoE\">1. \u6aa2\u67e5\u53c3\u6578\u503c<\/h3>\n<p>\u9996\u5148\uff0c\u6aa2\u67e5\u8abf\u7528\u5b58\u5132\u904e\u7a0b\u6216\u51fd\u6578\u6642\u50b3\u905e\u7684\u6240\u6709\u53c3\u6578\u3002\u78ba\u4fdd\u6240\u6709\u5fc5\u586b\u53c3\u6578\u90fd\u5df2\u6b63\u78ba\u8a2d\u7f6e\uff0c\u4e26\u4e14\u4e0d\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>DECLARE\n    v_param1 VARCHAR2(100);\nBEGIN\n    v_param1 := NULL; -- \u9019\u88e1\u6703\u5c0e\u81f4 ORA-23430 \u932f\u8aa4\n    my_procedure(v_param1);\nEND;\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u4f8b\u5b50\u4e2d\uff0c<code>v_param1<\/code> \u7684\u503c\u70ba NULL\uff0c\u9019\u5c07\u5c0e\u81f4\u932f\u8aa4\u3002\u61c9\u8a72\u5c07\u5176\u8a2d\u7f6e\u70ba\u6709\u6548\u7684\u5b57\u7b26\u4e32\u3002<\/p>\n<h3 id=\"2-%e6%aa%a2%e6%9f%a5%e6%95%b8%e6%93%9a%e5%ae%8c%e6%95%b4%e6%80%a7-YkbvGoCHoE\">2. \u6aa2\u67e5\u6578\u64da\u5b8c\u6574\u6027<\/h3>\n<p>\u5728\u9032\u884c\u6578\u64da\u63d2\u5165\u6216\u66f4\u65b0\u64cd\u4f5c\u6642\uff0c\u78ba\u4fdd\u6240\u6709\u5fc5\u586b\u5b57\u6bb5\u90fd\u6709\u6709\u6548\u7684\u6578\u64da\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>INSERT INTO my_table (column1, column2)\nVALUES (NULL, 'value2'); -- \u9019\u88e1\u6703\u5c0e\u81f4 ORA-23430 \u932f\u8aa4\n<\/code><\/pre>\n<p>\u5728\u9019\u7a2e\u60c5\u6cc1\u4e0b\uff0c<code>column1<\/code> \u4e0d\u80fd\u70ba NULL\uff0c\u61c9\u8a72\u63d0\u4f9b\u6709\u6548\u7684\u503c\u3002<\/p>\n<h3 id=\"3-%e6%aa%a2%e6%9f%a5%e8%a7%b8%e7%99%bc%e5%99%a8%e9%82%8f%e8%bc%af-YkbvGoCHoE\">3. \u6aa2\u67e5\u89f8\u767c\u5668\u908f\u8f2f<\/h3>\n<p>\u5982\u679c\u932f\u8aa4\u767c\u751f\u5728\u89f8\u767c\u5668\u4e2d\uff0c\u5247\u9700\u8981\u6aa2\u67e5\u89f8\u767c\u5668\u7684\u908f\u8f2f\uff0c\u78ba\u4fdd\u6240\u6709\u53c3\u6578\u90fd\u5df2\u6b63\u78ba\u8a2d\u7f6e\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>CREATE OR REPLACE TRIGGER my_trigger\nBEFORE INSERT ON my_table\nFOR EACH ROW\nBEGIN\n    IF :NEW.column1 IS NULL THEN\n        RAISE_APPLICATION_ERROR(-20001, 'column1 \u4e0d\u80fd\u70ba NULL');\n    END IF;\nEND;\n<\/code><\/pre>\n<p>\u9019\u6a23\u53ef\u4ee5\u5728\u63d2\u5165\u64cd\u4f5c\u4e4b\u524d\u6aa2\u67e5\u53c3\u6578\u7684\u6709\u6548\u6027\uff0c\u5f9e\u800c\u907f\u514d <code>ORA-23430<\/code> \u932f\u8aa4\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-YkbvGoCHoE\">\u7d50\u8ad6<\/h2>\n<p>\u5728 Oracle \u6578\u64da\u5eab\u4e2d\uff0c<code>ORA-23430<\/code> \u932f\u8aa4\u901a\u5e38\u662f\u7531\u65bc\u53c3\u6578\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\u5f15\u8d77\u7684\u3002\u901a\u904e\u6aa2\u67e5\u53c3\u6578\u503c\u3001\u6578\u64da\u5b8c\u6574\u6027\u4ee5\u53ca\u89f8\u767c\u5668\u908f\u8f2f\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u4fee\u5fa9\u6b64\u932f\u8aa4\u3002\u4e86\u89e3\u9019\u4e9b\u57fa\u672c\u7684\u6545\u969c\u6392\u9664\u6b65\u9a5f\u5c07\u6709\u52a9\u65bc\u958b\u767c\u8005\u548c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u66f4\u5feb\u5730\u89e3\u6c7a\u554f\u984c\uff0c\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u7a69\u5b9a\u904b\u884c\u3002<\/p>\n<p>\u5982\u9700\u9032\u4e00\u6b65\u4e86\u89e3\u5982\u4f55\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u6216\u6709\u5176\u4ed6\u76f8\u95dc\u554f\u984c\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u8cc7\u8a0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u6c7a ORA-23430 \u932f\u8aa4\uff0c\u53c3\u6578 \u201cstring\u201d \u4e0d\u80fd\u70ba NULL \u6216\u7a7a\u5b57\u7b26\u4e32\u7684\u554f\u984c\uff0c\u63d0\u4f9b\u6545\u969c\u4fee\u5fa9\u548c\u9060\u7a0b\u8655\u7406\u65b9\u6848\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-88122","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/88122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=88122"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/88122\/revisions"}],"predecessor-version":[{"id":88123,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/88122\/revisions\/88123"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=88122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=88122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=88122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}