{"id":6333,"date":"2024-11-14T14:24:04","date_gmt":"2024-11-14T06:24:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6333\/"},"modified":"2024-11-14T14:24:04","modified_gmt":"2024-11-14T06:24:04","slug":"mysql%e8%be%93%e5%87%ba%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6333\/","title":{"rendered":"mysql\u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u8bed\u53e5"},"content":{"rendered":"<blockquote><p>\n  \u4f7f\u7528 show create procedure \u8bed\u53e5\u53ef\u83b7\u53d6 mysql \u5b58\u50a8\u8fc7\u7a0b\u7684\u521b\u5efa\u8bed\u53e5\uff1a\u8bed\u6cd5\uff1ashow create procedure [database_name.]procedure_namedatabase_name\uff08\u53ef\u9009\uff09\uff1a\u6570\u636e\u5e93\u540d\u79f0\uff0c\u7701\u7565\u5219\u4f7f\u7528\u5f53\u524d\u6570\u636e\u5e93procedure_name\uff1a\u5b58\u50a8\u8fc7\u7a0b\u540d\u79f0\u793a\u4f8b\uff1ashow create procedure get_customer_info\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202407\/31\/2024073122520054624.jpg\" class=\"aligncenter\" title=\"mysql\u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u8bed\u53e5\u63d2\u56fe\" alt=\"mysql\u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u8bed\u53e5\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u8bed\u53e5<\/strong><\/p>\n<p>\u5728 MySQL \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 SHOW CREATE PROCEDURE \u8bed\u53e5\u6765\u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u7684\u521b\u5efa\u8bed\u53e5\u3002\u8be5\u8bed\u53e5\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u5b58\u50a8\u8fc7\u7a0b\u5b9a\u4e49\u7684\u6587\u672c\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u8bed\u6cd5<\/strong><\/p>\n<pre>SHOW CREATE PROCEDURE [database_name.]procedure_name<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u53c2\u6570<\/strong><\/p>\n<ul>\n<li> <strong>database_name (\u53ef\u9009)\uff1a<\/strong> \u8981\u4ece\u4e2d\u68c0\u7d22\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u5982\u679c\u7701\u7565\uff0c\u5219\u67e5\u8be2\u5f53\u524d\u6570\u636e\u5e93\u3002<\/li>\n<li> <strong>procedure_name\uff1a<\/strong> \u8981\u8f93\u51fa\u521b\u5efa\u8bed\u53e5\u7684\u5b58\u50a8\u8fc7\u7a0b\u7684\u540d\u79f0\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<p>\u8981\u8f93\u51fa\u540d\u4e3a get_customer_info \u7684\u5b58\u50a8\u8fc7\u7a0b\u7684\u521b\u5efa\u8bed\u53e5\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\uff1a<\/p>\n<pre>SHOW CREATE PROCEDURE get_customer_info<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u67e5\u8be2\u5c06\u8fd4\u56de\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\u7684\u6587\u672c\u5b57\u7b26\u4e32\uff1a<\/p>\n<pre>CREATE PROCEDURE get_customer_info(IN customer_id INT)\nBEGIN\n  SELECT * FROM customers WHERE customer_id = customer_id;\nEND<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8f93\u51fa\u7ed3\u679c<\/strong><\/p>\n<p>SHOW CREATE PROCEDURE \u8bed\u53e5\u7684\u8f93\u51fa\u7531\u4ee5\u4e0b\u90e8\u5206\u7ec4\u6210\uff1a<\/p>\n<ul>\n<li> <strong>CREATE PROCEDURE\uff1a<\/strong> \u58f0\u660e\u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b\u3002<\/li>\n<li> <strong>\u5b58\u50a8\u8fc7\u7a0b\u540d\u79f0\uff1a<\/strong> \u6240\u8bf7\u6c42\u5b58\u50a8\u8fc7\u7a0b\u7684\u540d\u79f0\u3002<\/li>\n<li> <strong>\u53c2\u6570\u5217\u8868 (\u5982\u679c\u5b58\u5728)\uff1a<\/strong> \u5b58\u50a8\u8fc7\u7a0b\u7684\u53c2\u6570\u5217\u8868\u3002<\/li>\n<li> <strong>BEGIN\uff1a<\/strong> \u5b58\u50a8\u8fc7\u7a0b\u4e3b\u4f53\u5f00\u59cb\u3002<\/li>\n<li> <strong>\u5b58\u50a8\u8fc7\u7a0b\u4e3b\u4f53\uff1a<\/strong> \u5b58\u50a8\u8fc7\u7a0b\u7684\u5b9e\u9645\u4ee3\u7801\u3002<\/li>\n<li> <strong>END\uff1a<\/strong> \u5b58\u50a8\u8fc7\u7a0b\u4e3b\u4f53\u7ed3\u675f\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u8bed\u53e5\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>\u4f7f\u7528 show create procedure \u8bed\u53e5\u53ef\u83b7\u53d6 mysql \u5b58\u50a8\u8fc7\u7a0b\u7684\u521b\u5efa\u8bed\u53e5\uff1a\u8bed\u6cd5\uff1ashow create procedure [database_name.]procedure_namedatabase_name\uff08\u53ef\u9009\uff09\uff1a\u6570\u636e\u5e93\u540d\u79f0\uff0c\u7701\u7565\u5219\u4f7f\u7528\u5f53\u524d\u6570\u636e\u5e93procedure_name\uff1a\u5b58\u50a8\u8fc7\u7a0b\u540d\u79f0\u793a\u4f8b\uff1ashow create procedure get_customer_info MySQL \u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u8bed\u53e5 \u5728 MySQL \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528 SHOW CREATE PROCEDURE \u8bed\u53e5\u6765\u8f93\u51fa\u5b58\u50a8\u8fc7\u7a0b\u7684\u521b\u5efa\u8bed\u53e5\u3002\u8be5\u8bed\u53e5\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u5b58\u50a8\u8fc7\u7a0b\u5b9a\u4e49\u7684\u6587\u672c\u5b57\u7b26\u4e32\u3002 \u8bed\u6cd5 SHOW CREATE PROCEDURE [database_name.]procedure_name \u767b\u5f55\u540e\u590d\u5236 \u53c2\u6570 database_name (\u53ef\u9009)\uff1a \u8981\u4ece\u4e2d\u68c0\u7d22\u5b58\u50a8\u8fc7\u7a0b\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u5982\u679c\u7701\u7565\uff0c\u5219\u67e5\u8be2\u5f53\u524d\u6570\u636e\u5e93\u3002 procedure_name\uff1a \u8981\u8f93\u51fa\u521b\u5efa\u8bed\u53e5\u7684\u5b58\u50a8\u8fc7\u7a0b\u7684\u540d\u79f0\u3002 \u793a\u4f8b \u8981\u8f93\u51fa\u540d\u4e3a get_customer_info \u7684\u5b58\u50a8\u8fc7\u7a0b\u7684\u521b\u5efa\u8bed\u53e5\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u67e5\u8be2\uff1a SHOW CREATE PROCEDURE get_customer_info \u767b\u5f55\u540e\u590d\u5236 \u8be5\u67e5\u8be2\u5c06\u8fd4\u56de\u7c7b\u4f3c\u4e8e\u4ee5\u4e0b\u5185\u5bb9\u7684\u6587\u672c\u5b57\u7b26\u4e32\uff1a CREATE PROCEDURE get_customer_info(IN customer_id INT) BEGIN SELECT * FROM customers WHERE [&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-6333","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6333","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=6333"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6333\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}