{"id":7728,"date":"2024-11-14T09:16:37","date_gmt":"2024-11-14T01:16:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7728\/"},"modified":"2024-11-14T09:16:37","modified_gmt":"2024-11-14T01:16:37","slug":"mysql%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%8f%82%e6%95%b0%e6%8a%a5%e9%94%99%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bc%a0%e5%85%a5%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%8f%82","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7728\/","title":{"rendered":"MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173120454478370.jpg\" class=\"aligncenter\" title=\"MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f\u63d2\u56fe\" alt=\"MySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4e3a\u4ec0\u4e48\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\u5206\u6790<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5728\u8c03\u7528 mysql \u5b58\u50a8\u8fc7\u7a0b\u65f6\uff0c\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u51fa\u73b0\u201cunknown column\u201d\u9519\u8bef\u3002\u800c\u4f20\u5165\u6574\u578b\u53c2\u6570\u65f6\uff0c\u5b58\u50a8\u8fc7\u7a0b\u8fd0\u884c\u6b63\u5e38\u3002<\/p>\n<p><strong>\u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\uff1a<\/strong><\/p>\n<pre>create procedure mypo02(in dataname varchar(10))\nbegin\n  if dataname is null or dataname = \"\" then\n      select * from ssd;\n  else\n      select * from ssd where ename like concat('%',dataname,'%');\n  end if;\nend;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9519\u8bef\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>Procedure execution failed\n1054 - Unknown column '\u738b\u5c0f\u674e' in 'field list'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5206\u6790\uff1a<\/strong><\/p>\n<p>\u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\u672c\u8eab\u5e76\u6ca1\u6709\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u95ee\u9898\u53ef\u80fd\u51fa\u5728\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u65f6\u3002\u5e38\u89c1\u7684\u539f\u56e0\u53ef\u80fd\u662f\uff1a<\/p>\n<ul>\n<li>\u8c03\u7528\u4ee3\u7801\u4e2d\u4f20\u5165\u7684\u53c2\u6570\u7c7b\u578b\u4e0d\u6b63\u786e\uff0c\u5bfc\u81f4\u5b9e\u9645\u4f20\u5165\u7684\u662f\u5b57\u7b26\u4e32\uff0c\u800c\u5b58\u50a8\u8fc7\u7a0b\u671f\u671b\u7684\u662f\u6574\u578b\u3002<\/li>\n<li>\u5728\u5b58\u50a8\u8fc7\u7a0b\u8c03\u7528\u4e4b\u524d\uff0c\u6ca1\u6709\u5bf9\u4f20\u5165\u53c2\u6570\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\uff0c\u5bfc\u81f4\u5b57\u7b26\u4e32\u53c2\u6570\u76f4\u63a5\u88ab\u89e3\u91ca\u4e3a\u5217\u540d\uff0c\u800c\u4e0d\u662f\u4f5c\u4e3a\u6bd4\u8f83\u503c\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\uff1a\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u62a5\u201cUnknown column\u201d\u9519\u8bef\uff1f\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>\u5b58\u50a8\u8fc7\u7a0b\u5b57\u7b26\u4e32\u53c2\u6570\u62a5\u9519\u5206\u6790 \u95ee\u9898\uff1a \u5728\u8c03\u7528 mysql \u5b58\u50a8\u8fc7\u7a0b\u65f6\uff0c\u4f20\u5165\u5b57\u7b26\u4e32\u53c2\u6570\u4f1a\u51fa\u73b0\u201cunknown column\u201d\u9519\u8bef\u3002\u800c\u4f20\u5165\u6574\u578b\u53c2\u6570\u65f6\uff0c\u5b58\u50a8\u8fc7\u7a0b\u8fd0\u884c\u6b63\u5e38\u3002 \u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\uff1a create procedure mypo02(in dataname varchar(10)) begin if dataname is null or dataname = &#8220;&#8221; then select * from ssd; else select * from ssd where ename like concat(&#8216;%&#8217;,dataname,&#8217;%&#8217;); end if; end; \u767b\u5f55\u540e\u590d\u5236 \u9519\u8bef\u4fe1\u606f\uff1a Procedure execution failed 1054 &#8211; Unknown column &#8216;\u738b\u5c0f\u674e&#8217; in &#8216;field list&#8217; \u767b\u5f55\u540e\u590d\u5236 \u5206\u6790\uff1a \u5b58\u50a8\u8fc7\u7a0b\u4ee3\u7801\u672c\u8eab\u5e76\u6ca1\u6709\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u95ee\u9898\u53ef\u80fd\u51fa\u5728\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b\u65f6\u3002\u5e38\u89c1\u7684\u539f\u56e0\u53ef\u80fd\u662f\uff1a \u8c03\u7528\u4ee3\u7801\u4e2d\u4f20\u5165\u7684\u53c2\u6570\u7c7b\u578b\u4e0d\u6b63\u786e\uff0c\u5bfc\u81f4\u5b9e\u9645\u4f20\u5165\u7684\u662f\u5b57\u7b26\u4e32\uff0c\u800c\u5b58\u50a8\u8fc7\u7a0b\u671f\u671b\u7684\u662f\u6574\u578b\u3002 [&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-7728","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7728","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=7728"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7728\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}