{"id":95004,"date":"2024-10-19T21:26:16","date_gmt":"2024-10-19T13:26:16","guid":{"rendered":"https:\/\/server.hk\/cnblog\/95004\/"},"modified":"2024-10-19T21:26:17","modified_gmt":"2024-10-19T13:26:17","slug":"oracle%e5%ad%98%e5%84%b2%e9%81%8e%e7%a8%8b%e5%89%b5%e5%bb%ba%e7%9a%84%e8%aa%9e%e6%b3%95%e5%8f%8a%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/95004\/","title":{"rendered":"ORACLE\u5b58\u5132\u904e\u7a0b\u5275\u5efa\u7684\u8a9e\u6cd5\u53ca\u6ce8\u610f\u4e8b\u9805"},"content":{"rendered":"<h1 id=\"oracle%e5%ad%98%e5%84%b2%e9%81%8e%e7%a8%8b%e5%89%b5%e5%bb%ba%e7%9a%84%e8%aa%9e%e6%b3%95%e5%8f%8a%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-ERarLZQyQz\">ORACLE\u5b58\u5132\u904e\u7a0b\u5275\u5efa\u7684\u8a9e\u6cd5\u53ca\u6ce8\u610f\u4e8b\u9805<\/h1>\n<p>\u5728Oracle\u6578\u64da\u5eab\u4e2d\uff0c\u5b58\u5132\u904e\u7a0b\u662f\u4e00\u7a2e\u91cd\u8981\u7684\u6578\u64da\u5eab\u5c0d\u8c61\uff0c\u80fd\u5920\u5c01\u88dd\u696d\u52d9\u908f\u8f2f\uff0c\u4e26\u63d0\u9ad8\u6578\u64da\u64cd\u4f5c\u7684\u6548\u7387\u3002\u672c\u6587\u5c07\u4ecb\u7d39Oracle\u5b58\u5132\u904e\u7a0b\u7684\u5275\u5efa\u8a9e\u6cd5\u53ca\u76f8\u95dc\u6ce8\u610f\u4e8b\u9805\uff0c\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u597d\u5730\u4f7f\u7528\u9019\u4e00\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e5%ad%98%e5%84%b2%e9%81%8e%e7%a8%8b%e7%9a%84%e5%9f%ba%e6%9c%ac%e8%aa%9e%e6%b3%95-ERarLZQyQz\">\u5b58\u5132\u904e\u7a0b\u7684\u57fa\u672c\u8a9e\u6cd5<\/h2>\n<p>\u5275\u5efa\u5b58\u5132\u904e\u7a0b\u7684\u57fa\u672c\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>\nCREATE [OR REPLACE] PROCEDURE procedure_name\n   [ (parameter1 [IN | OUT | IN OUT] datatype, ... ) ]\nIS\n   [declaration_section]\nBEGIN\n   [executable_section]\nEXCEPTION\n   [exception_handler]\nEND procedure_name;\n<\/code><\/pre>\n<h3 id=\"%e8%aa%9e%e6%b3%95%e8%a7%a3%e6%9e%90-ERarLZQyQz\">\u8a9e\u6cd5\u89e3\u6790<\/h3>\n<ul>\n<li><strong>CREATE [OR REPLACE]<\/strong>: \u7528\u65bc\u5275\u5efa\u65b0\u7684\u5b58\u5132\u904e\u7a0b\uff0c\u6216\u66ff\u63db\u5df2\u5b58\u5728\u7684\u5b58\u5132\u904e\u7a0b\u3002<\/li>\n<li><strong>procedure_name<\/strong>: \u5b58\u5132\u904e\u7a0b\u7684\u540d\u7a31\uff0c\u5fc5\u9808\u552f\u4e00\u3002<\/li>\n<li><strong>parameter<\/strong>: \u53ef\u9078\u7684\u53c3\u6578\u5217\u8868\uff0c\u652f\u6301\u4e09\u7a2e\u6a21\u5f0f\uff1aIN\uff08\u8f38\u5165\uff09\u3001OUT\uff08\u8f38\u51fa\uff09\u3001IN OUT\uff08\u8f38\u5165\u8f38\u51fa\uff09\u3002<\/li>\n<li><strong>declaration_section<\/strong>: \u53ef\u9078\u7684\u8b8a\u91cf\u8072\u660e\u5340\u57df\u3002<\/li>\n<li><strong>executable_section<\/strong>: \u5b58\u5132\u904e\u7a0b\u7684\u4e3b\u8981\u908f\u8f2f\u90e8\u5206\u3002<\/li>\n<li><strong>exception_handler<\/strong>: \u53ef\u9078\u7684\u7570\u5e38\u8655\u7406\u5340\u57df\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%89%b5%e5%bb%ba%e5%ad%98%e5%84%b2%e9%81%8e%e7%a8%8b%e7%9a%84%e7%a4%ba%e4%be%8b-ERarLZQyQz\">\u5275\u5efa\u5b58\u5132\u904e\u7a0b\u7684\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u5b58\u5132\u904e\u7a0b\u793a\u4f8b\uff0c\u8a72\u904e\u7a0b\u7528\u65bc\u8a08\u7b97\u5169\u500b\u6578\u5b57\u7684\u548c\uff1a<\/p>\n<pre><code>\nCREATE OR REPLACE PROCEDURE add_numbers\n   (num1 IN NUMBER, num2 IN NUMBER, result OUT NUMBER)\nIS\nBEGIN\n   result := num1 + num2;\nEND add_numbers;\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c<code>add_numbers<\/code> \u5b58\u5132\u904e\u7a0b\u63a5\u53d7\u5169\u500b\u8f38\u5165\u53c3\u6578 <code>num1<\/code> \u548c <code>num2<\/code>\uff0c\u4e26\u5c07\u5b83\u5011\u7684\u548c\u8fd4\u56de\u7d66 <code>result<\/code>\u3002<\/p>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-ERarLZQyQz\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<ul>\n<li><strong>\u547d\u540d\u898f\u5247<\/strong>: \u5b58\u5132\u904e\u7a0b\u7684\u540d\u7a31\u61c9\u8a72\u5177\u6709\u63cf\u8ff0\u6027\uff0c\u4fbf\u65bc\u7406\u89e3\u5176\u529f\u80fd\u3002<\/li>\n<li><strong>\u53c3\u6578\u985e\u578b<\/strong>: \u78ba\u4fdd\u9078\u64c7\u6b63\u78ba\u7684\u6578\u64da\u985e\u578b\uff0c\u4ee5\u907f\u514d\u985e\u578b\u4e0d\u5339\u914d\u7684\u932f\u8aa4\u3002<\/li>\n<li><strong>\u7570\u5e38\u8655\u7406<\/strong>: \u5728\u5b58\u5132\u904e\u7a0b\u4e2d\u6dfb\u52a0\u7570\u5e38\u8655\u7406\u908f\u8f2f\uff0c\u4ee5\u63d0\u9ad8\u7a0b\u5e8f\u7684\u7a69\u5b9a\u6027\u3002<\/li>\n<li><strong>\u6027\u80fd\u8003\u91cf<\/strong>: \u5118\u91cf\u6e1b\u5c11\u5b58\u5132\u904e\u7a0b\u4e2d\u7684\u5faa\u74b0\u548c\u8907\u96dc\u908f\u8f2f\uff0c\u4ee5\u63d0\u9ad8\u57f7\u884c\u6548\u7387\u3002<\/li>\n<li><strong>\u6e2c\u8a66<\/strong>: \u5728\u6b63\u5f0f\u74b0\u5883\u4e2d\u4f7f\u7528\u4e4b\u524d\uff0c\u61c9\u5145\u5206\u6e2c\u8a66\u5b58\u5132\u904e\u7a0b\u7684\u529f\u80fd\u548c\u6027\u80fd\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b5%90%e8%ab%96-ERarLZQyQz\">\u7d50\u8ad6<\/h2>\n<p>Oracle\u5b58\u5132\u904e\u7a0b\u662f\u4e00\u500b\u5f37\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e6b\u52a9\u958b\u767c\u8005\u5c01\u88dd\u696d\u52d9\u908f\u8f2f\uff0c\u63d0\u9ad8\u6578\u64da\u64cd\u4f5c\u7684\u6548\u7387\u3002\u901a\u904e\u6b63\u78ba\u7684\u8a9e\u6cd5\u548c\u6ce8\u610f\u4e8b\u9805\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u6709\u6548\u5730\u5275\u5efa\u548c\u7ba1\u7406\u5b58\u5132\u904e\u7a0b\uff0c\u5f9e\u800c\u63d0\u5347\u61c9\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\u548c\u53ef\u7dad\u8b77\u6027\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u95dc\u65bc<code>VPS<\/code>\u3001<code>\u9999\u6e2fVPS<\/code>\u53ca\u5176\u4ed6\u76f8\u95dc\u670d\u52d9\u7684\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9 <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3ORACLE\u5b58\u5132\u904e\u7a0b\u5275\u5efa\u7684\u8a9e\u6cd5\u53ca\u6ce8\u610f\u4e8b\u9805\uff0c\u638c\u63e1\u6700\u4f73\u5be6\u8e10\uff0c\u63d0\u5347\u6578\u64da\u5eab\u958b\u767c\u6548\u7387\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-95004","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/95004","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=95004"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/95004\/revisions"}],"predecessor-version":[{"id":95005,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/95004\/revisions\/95005"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=95004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=95004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=95004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}