{"id":88627,"date":"2026-08-01T14:16:31","date_gmt":"2026-08-01T06:16:31","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/88627.html"},"modified":"2026-08-01T14:16:31","modified_gmt":"2026-08-01T06:16:31","slug":"%e4%ba%8b%e5%8a%a1%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e8%bd%ac%e8%b4%a6%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/88627.html","title":{"rendered":"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd"},"content":{"rendered":"<p>\u7b14\u8bb0\u8bf4\u660e&#xff1a;\u6309\u201c\u529f\u80fd\u6982\u8ff0\u2192\u4ee3\u7801\u62c6\u5206\u2192\u6838\u5fc3\u77e5\u8bc6\u70b9\u2192\u6ce8\u610f\u4e8b\u9879\u2192\u6d4b\u8bd5\u5206\u6790\u201d\u7ed3\u6784\u6574\u7406&#xff0c;\u4fdd\u7559\u539f\u4ee3\u7801\u6838\u5fc3\u903b\u8f91&#xff0c;\u8865\u5145\u8be6\u7ec6\u6ce8\u91ca\u548c\u8003\u70b9\u89e3\u6790&#xff0c;\u9002\u914d\u671f\u672b\u590d\u4e60\u548c\u5b9e\u64cd\u8c03\u8bd5\u3002<\/p>\n<h3>\u4e00\u3001\u529f\u80fd\u6982\u8ff0<\/h3>\n<p>\u672c\u6848\u4f8b\u901a\u8fc7**\u5b58\u50a8\u8fc7\u7a0b&#043;\u4e8b\u52a1**\u5b9e\u73b0\u94f6\u884c\u5361\u8f6c\u8d26\u529f\u80fd&#xff0c;\u6838\u5fc3\u76ee\u6807\u662f\u4fdd\u8bc1\u8f6c\u8d26\u64cd\u4f5c\u7684\u539f\u5b50\u6027&#xff08;\u8f6c\u51fa\u548c\u8f6c\u5165\u8981\u4e48\u5168\u6210\u529f&#xff0c;\u8981\u4e48\u5168\u5931\u8d25&#xff09;&#xff0c;\u907f\u514d\u56e0\u90e8\u5206\u64cd\u4f5c\u5931\u8d25\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4&#xff08;\u5982\u94b1\u8f6c\u51fa\u6210\u529f\u4f46\u8f6c\u5165\u5931\u8d25&#xff0c;\u51fa\u73b0\u8d44\u91d1\u6d41\u5931&#xff09;\u3002<\/p>\n<p>\u6d89\u53ca\u8868&#xff1a;CardNew&#xff08;\u94f6\u884c\u5361\u8868&#xff0c;\u5305\u542bStdudentId\u3001StudentName\u3001CurrentMoney\u5b57\u6bb5&#xff0c;\u5176\u4e2dCurrentMoney\u6709check\u7ea6\u675f&#xff1a;\u4f59\u989d&gt;1&#xff09;\u3002<\/p>\n<h3>\u4e8c\u3001\u4ee3\u7801\u62c6\u5206\u8be6\u89e3<\/h3>\n<h4>\u6a21\u57571&#xff1a;\u5b58\u50a8\u8fc7\u7a0b\u5220\u9664&#xff08;\u907f\u514d\u91cd\u590d\u521b\u5efa&#xff09;<\/h4>\n<p>&#8212; \u5224\u65ad\u5b58\u50a8\u8fc7\u7a0bTest1\u662f\u5426\u5b58\u5728&#xff0c;\u82e5\u5b58\u5728\u5219\u5220\u9664<br \/>\nif exists(select * from sysobjects where name &#061; &#039;Test1&#039;)<br \/>\n   drop proc Test1;<br \/>\ngo<\/p>\n<p>\u6838\u5fc3\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>sysobjects&#xff1a;\u7cfb\u7edf\u8868&#xff0c;\u5b58\u50a8\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61&#xff08;\u5b58\u50a8\u8fc7\u7a0b\u3001\u8868\u3001\u89c6\u56fe\u7b49&#xff09;\u7684\u4fe1\u606f\u3002<\/p>\n<\/li>\n<li>\n<p>exists&#xff1a;\u5224\u65ad\u5b58\u50a8\u8fc7\u7a0b\u662f\u5426\u5b58\u5728&#xff0c;\u907f\u514d\u91cd\u590d\u521b\u5efa\u5bfc\u81f4\u201c\u5df2\u5b58\u5728\u540c\u540d\u5bf9\u8c61\u201d\u62a5\u9519\u3002<\/p>\n<\/li>\n<li>\n<p>go&#xff1a;\u6279\u5904\u7406\u7ed3\u675f\u6807\u8bb0&#xff0c;\u5c06\u524d\u540e\u4ee3\u7801\u5206\u9694\u4e3a\u72ec\u7acb\u7684\u6267\u884c\u6279\u6b21\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>\u6a21\u57572&#xff1a;\u521b\u5efa\u8f6c\u8d26\u5b58\u50a8\u8fc7\u7a0b&#xff08;\u6838\u5fc3\u4ee3\u7801&#xff09;<\/h4>\n<p>&#8212; \u521b\u5efa\u5b58\u50a8\u8fc7\u7a0bTest1&#xff0c;\u5b9e\u73b0\u8f6c\u8d26\u529f\u80fd<br \/>\ncreate proc Test1<br \/>\n &#064;inAccount int,   &#8212; \u5165\u8d26\u8d26\u53f7&#xff08;\u63a5\u6536\u8f6c\u8d26\u7684\u94f6\u884c\u5361ID&#xff09;<br \/>\n &#064;outAccout int,   &#8212; \u51fa\u8d26\u8d26\u53f7&#xff08;\u8f6c\u51fa\u91d1\u989d\u7684\u94f6\u884c\u5361ID&#xff0c;\u6ce8\u610f\u539f\u4ee3\u7801\u62fc\u5199&#xff1a;outAccout&#xff09;<br \/>\n &#064;jine int         &#8212; \u8f6c\u8d26\u91d1\u989d<br \/>\nas<br \/>\nbegin<br \/>\n    &#8212; \u5173\u95ed\u8ba1\u6570\u6d88\u606f\u8fd4\u56de&#xff0c;\u63d0\u5347\u5b58\u50a8\u8fc7\u7a0b\u6267\u884c\u6548\u7387&#xff08;\u53ef\u9009&#xff0c;\u63a8\u8350\u6dfb\u52a0&#xff09;<br \/>\n    SET NOCOUNT ON;<\/p>\n<p>    &#8212; \u5b9a\u4e49\u53d8\u91cf&#xff1a;\u7edf\u8ba1\u4e8b\u52a1\u4e2dSQL\u6267\u884c\u7684\u9519\u8bef\u4e2a\u6570&#xff08;0&#061;\u65e0\u9519\u8bef&#xff0c;\u975e0&#061;\u6709\u9519\u8bef&#xff09;<br \/>\n    declare &#064;errorNum int;<br \/>\n    set &#064;errorNum &#061; 0;<\/p>\n<p>    &#8212; \u5f00\u542f\u4e8b\u52a1&#xff1a;\u6807\u8bb0\u4e8b\u52a1\u7684\u5f00\u59cb&#xff0c;\u540e\u7eed\u64cd\u4f5c\u7eb3\u5165\u4e8b\u52a1\u7ba1\u7406<br \/>\n    begin transaction;<\/p>\n<p>    begin<br \/>\n        &#8212; 1. \u8f6c\u51fa\u903b\u8f91&#xff1a;\u4ece\u51fa\u8d26\u8d26\u53f7\u6263\u9664\u6307\u5b9a\u91d1\u989d<br \/>\n        update CardNew<br \/>\n        set CurrentMoney &#061; CurrentMoney &#8211; &#064;jine<br \/>\n        where StdudentId &#061; &#064;outAccout;<\/p>\n<p>        &#8212; \u8bb0\u5f55\u8f6c\u51fa\u64cd\u4f5c\u7684\u9519\u8bef\u7801&#xff1a;&#064;&#064;ERROR\u662f\u5168\u5c40\u53d8\u91cf&#xff0c;\u8fd4\u56de\u4e0a\u4e00\u6761SQL\u7684\u9519\u8bef\u7801<br \/>\n        set &#064;errorNum &#061; &#064;errorNum &#043; &#064;&#064;ERROR;<\/p>\n<p>        &#8212; 2. \u8f6c\u5165\u903b\u8f91&#xff1a;\u5411\u5165\u8d26\u8d26\u53f7\u589e\u52a0\u6307\u5b9a\u91d1\u989d<br \/>\n        update CardNew<br \/>\n        set CurrentMoney &#061; CurrentMoney &#043; &#064;jine<br \/>\n        where StdudentId &#061; &#064;inAccount;<\/p>\n<p>        &#8212; \u8bb0\u5f55\u8f6c\u5165\u64cd\u4f5c\u7684\u9519\u8bef\u7801&#xff0c;\u7d2f\u8ba1\u9519\u8bef\u4e2a\u6570<br \/>\n        set &#064;errorNum &#061; &#064;errorNum &#043; &#064;&#064;ERROR;<\/p>\n<p>        &#8212; 3. \u5224\u65ad\u4e8b\u52a1\u6267\u884c\u72b6\u6001&#xff0c;\u51b3\u5b9a\u63d0\u4ea4\u6216\u56de\u6eda<br \/>\n        if(&#064;errorNum &gt; 0)  &#8212; \u5b58\u5728\u9519\u8bef&#xff08;\u5982\u8d26\u53f7\u4e0d\u5b58\u5728\u3001\u4f59\u989d\u4e0d\u8db3\u8fdd\u53cd\u7ea6\u675f&#xff09;<br \/>\n        begin<br \/>\n            rollback transaction; &#8212; \u56de\u6eda\u4e8b\u52a1&#xff1a;\u64a4\u9500\u6240\u6709\u672a\u63d0\u4ea4\u7684\u64cd\u4f5c<br \/>\n            print &#039;\u8f6c\u8d26\u5931\u8d25&#xff0c;\u4e8b\u52a1\u5df2\u56de\u6eda&#xff08;\u9519\u8bef\u7d2f\u8ba1\u6570&#xff1a;&#039; &#043; CAST(&#064;errorNum as varchar) &#043; &#039;&#xff09;&#039;;<br \/>\n        end<br \/>\n        else  &#8212; \u65e0\u9519\u8bef&#xff0c;\u6240\u6709\u64cd\u4f5c\u6267\u884c\u6210\u529f<br \/>\n        begin<br \/>\n            commit transaction; &#8212; \u63d0\u4ea4\u4e8b\u52a1&#xff1a;\u5c06\u64cd\u4f5c\u7ed3\u679c\u6c38\u4e45\u4fdd\u5b58\u5230\u6570\u636e\u5e93<br \/>\n            print &#039;\u8f6c\u8d26\u6210\u529f&#xff0c;\u4e8b\u52a1\u5df2\u63d0\u4ea4&#039;;<br \/>\n        end<br \/>\n    end<\/p>\n<p>    &#8212; \u5f00\u542f\u8ba1\u6570\u6d88\u606f\u8fd4\u56de&#xff0c;\u6062\u590d\u9ed8\u8ba4\u8bbe\u7f6e<br \/>\n    SET NOCOUNT OFF;<br \/>\nend<br \/>\ngo<\/p>\n<p>\u6838\u5fc3\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>create proc \u5b58\u50a8\u8fc7\u7a0b\u540d&#xff1a;\u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b&#xff0c;\u62ec\u53f7\u5185\u4e3a\u8f93\u5165\u53c2\u6570&#xff0c;\u9700\u6307\u5b9a\u53c2\u6570\u7c7b\u578b\u548c\u6ce8\u91ca\u3002<\/p>\n<\/li>\n<li>\n<p>&#064;&#064;ERROR&#xff1a;\u5168\u5c40\u53d8\u91cf&#xff0c;\u6838\u5fc3\u8003\u70b9&#xff01;\u8fd4\u56de\u4e0a\u4e00\u6761SQL\u8bed\u53e5\u7684\u9519\u8bef\u7801&#xff0c;0\u8868\u793a\u65e0\u9519\u8bef&#xff0c;\u975e0\u8868\u793a\u6709\u9519\u8bef&#xff08;\u5982\u8fdd\u53cdcheck\u7ea6\u675f\u3001\u8bed\u6cd5\u9519\u8bef&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>begin transaction&#xff1a;\u5f00\u542f\u4e8b\u52a1&#xff0c;\u540e\u7eed\u7684update\u64cd\u4f5c\u4f5c\u4e3a\u4e00\u4e2a\u6574\u4f53&#xff0c;\u8981\u4e48\u5168\u6267\u884c&#xff0c;\u8981\u4e48\u5168\u64a4\u9500\u3002<\/p>\n<\/li>\n<li>\n<p>rollback transaction&#xff1a;\u56de\u6eda\u4e8b\u52a1&#xff0c;\u5f53\u4e8b\u52a1\u4e2d\u4efb\u610f\u4e00\u6b65\u51fa\u9519&#xff0c;\u64a4\u9500\u6240\u6709\u64cd\u4f5c&#xff0c;\u6062\u590d\u5230\u4e8b\u52a1\u5f00\u542f\u524d\u7684\u72b6\u6001\u3002<\/p>\n<\/li>\n<li>\n<p>commit transaction&#xff1a;\u63d0\u4ea4\u4e8b\u52a1&#xff0c;\u5f53\u6240\u6709\u64cd\u4f5c\u65e0\u9519\u8bef\u65f6&#xff0c;\u5c06\u4fee\u6539\u6c38\u4e45\u4fdd\u5b58&#xff0c;\u4e8b\u52a1\u7ed3\u675f\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>\u6a21\u57573&#xff1a;\u6d4b\u8bd5\u5b58\u50a8\u8fc7\u7a0b&#xff08;\u8f6c\u8d26\u6210\u529f\u573a\u666f&#xff09;<\/h4>\n<p>&#8212; \u6d4b\u8bd5\u573a\u666f1&#xff1a;\u8f6c\u8d26\u6210\u529f&#xff08;\u524d\u63d0&#xff1a;CardNew\u8868\u4e2d\u5b58\u57281000\u30011003\u8d26\u53f7&#xff0c;\u4e141003\u4f59\u989d\u22651000&#043;1&#xff09;<br \/>\nprint &#039;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u6d4b\u8bd5\u573a\u666f1&#xff1a;\u6b63\u5e38\u8f6c\u8d26 &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#039;;<br \/>\nexec Test1 1000, 1003, 1000; &#8212; \u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b&#xff1a;\u5165\u8d261000&#xff0c;\u51fa\u8d261003&#xff0c;\u8f6c\u8d261000\u5143<br \/>\nselect * from CardNew; &#8212; \u67e5\u8be2\u8f6c\u8d26\u540e\u6570\u636e&#xff0c;\u9a8c\u8bc1\u4f59\u989d\u53d8\u5316<br \/>\nprint &#039;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#039;;<\/p>\n<p>\u6d4b\u8bd5\u524d\u63d0&#xff1a;CardNew\u8868\u4e2dStdudentId&#061;1003\u7684\u8d26\u53f7\u521d\u59cb\u4f59\u989d\u9700\u5927\u4e8e1000&#xff08;\u59821400&#xff09;&#xff0c;\u6263\u96641000\u540e\u4f59\u989d\u4e3a400&#xff0c;\u6ee1\u8db3check\u7ea6\u675f&#xff08;\u4f59\u989d&gt;1&#xff09;&#xff0c;\u64cd\u4f5c\u65e0\u9519\u8bef&#xff0c;\u4e8b\u52a1\u63d0\u4ea4\u3002<\/p>\n<h4>\u6a21\u57574&#xff1a;\u6d4b\u8bd5\u5b58\u50a8\u8fc7\u7a0b&#xff08;\u8f6c\u8d26\u5931\u8d25\u573a\u666f&#xff09;<\/h4>\n<p>&#8212; \u6d4b\u8bd5\u573a\u666f2&#xff1a;\u8f6c\u8d26\u5931\u8d25&#xff08;\u524d\u63d0&#xff1a;\u7ecf\u8fc7\u573a\u666f1\u8f6c\u8d26\u540e&#xff0c;1003\u8d26\u53f7\u4f59\u989d\u4e3a400&#xff0c;\u518d\u6b21\u8f6c\u8d261000\u5143\u4f1a\u5bfc\u81f4\u4f59\u989d\u4e0d\u8db3&#xff09;<br \/>\nprint &#039;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u6d4b\u8bd5\u573a\u666f2&#xff1a;\u8f6c\u8d26\u5931\u8d25&#xff08;\u4f59\u989d\u4e0d\u8db3&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#039;;<br \/>\nexec Test1 1000, 1003, 1000; &#8212; \u518d\u6b21\u8c03\u7528\u5b58\u50a8\u8fc7\u7a0b&#xff0c;\u8f6c\u8d261000\u5143<br \/>\nselect * from CardNew; &#8212; \u67e5\u8be2\u6570\u636e&#xff0c;\u9a8c\u8bc1\u4e8b\u52a1\u56de\u6eda\u540e\u4f59\u989d\u672a\u53d8\u5316<br \/>\nprint &#039;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#039;;<\/p>\n<p>\u6d4b\u8bd5\u5206\u6790&#xff1a;1003\u8d26\u53f7\u4f59\u989d400&#xff0c;\u6263\u96641000\u540e\u4f59\u989d\u4e3a-600&#xff0c;\u8fdd\u53cdCardNew\u8868\u7684check(CurrentMoney&gt;1)\u7ea6\u675f&#xff0c;\u8f6c\u51fa\u64cd\u4f5c\u62a5\u9519&#xff0c;&#064;&#064;ERROR\u8fd4\u56de\u975e0\u503c&#xff0c;&#064;errorNum&gt;0&#xff0c;\u89e6\u53d1\u4e8b\u52a1\u56de\u6eda&#xff0c;\u4e24\u4e2aupdate\u64cd\u4f5c\u5747\u88ab\u64a4\u9500&#xff0c;\u4f59\u989d\u6062\u590d\u5230\u8f6c\u8d26\u524d\u7684\u72b6\u6001\u3002<\/p>\n<h3>\u4e09\u3001\u6838\u5fc3\u8003\u70b9\u603b\u7ed3&#xff08;\u5fc5\u80cc&#xff09;<\/h3>\n<h4>1. \u4e8b\u52a1\u7684\u6838\u5fc3\u4f5c\u7528<\/h4>\n<p>\u89e3\u51b3\u591a\u6b65DML\u64cd\u4f5c&#xff08;insert\u3001update\u3001delete&#xff09;\u7684\u6570\u636e\u4e00\u81f4\u6027\u95ee\u9898&#xff0c;\u786e\u4fdd\u64cd\u4f5c\u7684\u539f\u5b50\u6027&#xff08;\u8981\u4e48\u5168\u6210\u529f&#xff0c;\u8981\u4e48\u5168\u5931\u8d25&#xff09;&#xff0c;\u5178\u578b\u573a\u666f&#xff1a;\u8f6c\u8d26\u3001\u6279\u91cf\u4fee\u6539\u3001\u8ba2\u5355\u652f\u4ed8\u3002<\/p>\n<h4>2. \u4e8b\u52a1\u7684\u6838\u5fc3\u8bed\u6cd5&#xff08;3\u53e5&#xff09;<\/h4>\n<ul>\n<li>\n<p>\u5f00\u542f\u4e8b\u52a1&#xff1a;begin transaction<\/p>\n<\/li>\n<li>\n<p>\u63d0\u4ea4\u4e8b\u52a1&#xff1a;commit transaction&#xff08;\u65e0\u9519\u8bef\u65f6\u6267\u884c&#xff0c;\u6570\u636e\u6c38\u4e45\u4fdd\u5b58&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u56de\u6eda\u4e8b\u52a1&#xff1a;rollback transaction&#xff08;\u6709\u9519\u8bef\u65f6\u6267\u884c&#xff0c;\u64a4\u9500\u6240\u6709\u64cd\u4f5c&#xff09;<\/p>\n<\/li>\n<\/ul>\n<h4>3. &#064;&#064;ERROR\u5168\u5c40\u53d8\u91cf\u7684\u7279\u70b9<\/h4>\n<ul>\n<li>\n<p>\u4ec5\u8fd4\u56de\u201c\u4e0a\u4e00\u6761SQL\u8bed\u53e5\u201d\u7684\u9519\u8bef\u7801&#xff0c;\u9700\u6bcf\u6b21\u64cd\u4f5c\u540e\u7acb\u5373\u7d2f\u52a0&#xff0c;\u5426\u5219\u4f1a\u88ab\u540e\u7eed\u64cd\u4f5c\u8986\u76d6\u3002<\/p>\n<\/li>\n<li>\n<p>0\u8868\u793a\u65e0\u9519\u8bef&#xff0c;\u975e0\u8868\u793a\u6709\u9519\u8bef&#xff08;\u4e0d\u540c\u9519\u8bef\u5bf9\u5e94\u4e0d\u540c\u9519\u8bef\u7801&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u53ef\u7528\u4e8e\u5224\u65ad\u4e8b\u52a1\u4e2d\u662f\u5426\u51fa\u73b0\u5f02\u5e38&#xff0c;\u662f\u4e8b\u52a1\u56de\u6eda\u7684\u6838\u5fc3\u4f9d\u636e\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>4. \u672c\u6848\u4f8b\u4e2d\u8f6c\u8d26\u5931\u8d25\u7684\u5e38\u89c1\u539f\u56e0<\/h4>\n<ul>\n<li>\n<p>\u51fa\u8d26\u8d26\u53f7\/\u5165\u8d26\u8d26\u53f7\u4e0d\u5b58\u5728&#xff08;StdudentId\u65e0\u5339\u914d\u8bb0\u5f55&#xff09;&#xff0c;update\u64cd\u4f5c\u65e0\u5f71\u54cd&#xff0c;\u4f46&#064;&#064;ERROR\u4ecd\u4e3a0&#xff08;\u9700\u989d\u5916\u6dfb\u52a0\u8d26\u53f7\u5b58\u5728\u6027\u5224\u65ad&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u51fa\u8d26\u8d26\u53f7\u4f59\u989d\u4e0d\u8db3&#xff0c;\u6263\u9664\u91d1\u989d\u540e\u4f59\u989d\u22641&#xff0c;\u8fdd\u53cdcheck\u7ea6\u675f&#xff0c;\u89e6\u53d1\u62a5\u9519&#xff0c;&#064;&#064;ERROR\u8fd4\u56de\u975e0\u503c\u3002<\/p>\n<\/li>\n<li>\n<p>\u8f6c\u8d26\u91d1\u989d\u22640&#xff0c;\u5bfc\u81f4\u4f59\u989d\u8ba1\u7b97\u5f02\u5e38&#xff08;\u53ef\u6dfb\u52a0\u91d1\u989d\u5408\u6cd5\u6027\u5224\u65ad\u4f18\u5316&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u56db\u3001\u6613\u9519\u70b9\u4e0e\u4f18\u5316\u5efa\u8bae<\/h3>\n<h4>1. \u539f\u4ee3\u7801\u6613\u9519\u70b9<\/h4>\n<ul>\n<li>\n<p>\u53c2\u6570\u62fc\u5199\u9519\u8bef&#xff1a;&#064;outAccout&#xff08;\u6b63\u786e\u5e94\u4e3a&#064;outAccount&#xff09;&#xff0c;\u867d\u4e0d\u5f71\u54cd\u6267\u884c&#xff0c;\u4f46\u4e0d\u7b26\u5408\u547d\u540d\u89c4\u8303&#xff0c;\u5efa\u8bae\u4fee\u6b63\u3002<\/p>\n<\/li>\n<li>\n<p>\u65e0\u9519\u8bef\u63d0\u793a&#xff1a;\u539f\u4ee3\u7801\u672a\u6dfb\u52a0print\u8bed\u53e5&#xff0c;\u65e0\u6cd5\u76f4\u89c2\u5224\u65ad\u8f6c\u8d26\u6210\u529f\/\u5931\u8d25&#xff0c;\u5efa\u8bae\u8865\u5145\u3002<\/p>\n<\/li>\n<li>\n<p>\u65e0\u524d\u7f6e\u5224\u65ad&#xff1a;\u672a\u5224\u65ad\u8d26\u53f7\u662f\u5426\u5b58\u5728\u3001\u91d1\u989d\u662f\u5426\u5408\u6cd5&#xff0c;\u5efa\u8bae\u5728\u4e8b\u52a1\u5f00\u542f\u524d\u6dfb\u52a0\u4e1a\u52a1\u903b\u8f91\u5224\u65ad&#xff0c;\u51cf\u5c11\u65e0\u6548\u4e8b\u52a1\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u4f18\u5316\u5efa\u8bae&#xff08;\u53ef\u9009&#xff0c;\u63d0\u5347\u5065\u58ee\u6027&#xff09;<\/h4>\n<p>&#8212; \u4f18\u5316&#xff1a;\u6dfb\u52a0\u91d1\u989d\u5408\u6cd5\u6027\u548c\u8d26\u53f7\u5b58\u5728\u6027\u5224\u65ad&#xff08;\u653e\u5728\u4e8b\u52a1\u5f00\u542f\u524d&#xff09;<br \/>\nif(&#064;jine &lt;&#061; 0)<br \/>\nbegin<br \/>\n    raiserror(&#039;\u8f6c\u8d26\u91d1\u989d\u5fc5\u987b\u5927\u4e8e0&#039;,16,1);<br \/>\n    return;<br \/>\nend<\/p>\n<p>if not exists(select 1 from CardNew where StdudentId &#061; &#064;outAccout)<br \/>\nbegin<br \/>\n    raiserror(&#039;\u51fa\u8d26\u8d26\u53f7\u4e0d\u5b58\u5728&#039;,16,1);<br \/>\n    return;<br \/>\nend<\/p>\n<p>if not exists(select 1 from CardNew where StdudentId &#061; &#064;inAccount)<br \/>\nbegin<br \/>\n    raiserror(&#039;\u5165\u8d26\u8d26\u53f7\u4e0d\u5b58\u5728&#039;,16,1);<br \/>\n    return;<br \/>\nend<\/p>\n<h3>\u4e94\u3001\u6d4b\u8bd5\u7ed3\u679c\u5206\u6790<\/h3>\n<h4>\u573a\u666f1&#xff08;\u6210\u529f&#xff09;<\/h4>\n<p>\u6267\u884c\u7ed3\u679c&#xff1a;\u51fa\u8d26\u8d26\u53f71003\u4f59\u989d\u51cf\u5c111000&#xff0c;\u5165\u8d26\u8d26\u53f71000\u4f59\u989d\u589e\u52a01000&#xff0c;\u4e8b\u52a1\u63d0\u4ea4&#xff0c;\u6253\u5370\u201c\u8f6c\u8d26\u6210\u529f&#xff0c;\u4e8b\u52a1\u5df2\u63d0\u4ea4\u201d\u3002<\/p>\n<h4>\u573a\u666f2&#xff08;\u5931\u8d25&#xff09;<\/h4>\n<p>\u6267\u884c\u7ed3\u679c&#xff1a;\u51fa\u8d26\u8d26\u53f71003\u4f59\u989d\u672a\u53d8\u5316&#xff0c;\u5165\u8d26\u8d26\u53f71000\u4f59\u989d\u672a\u53d8\u5316&#xff0c;\u4e8b\u52a1\u56de\u6eda&#xff0c;\u6253\u5370\u201c\u8f6c\u8d26\u5931\u8d25&#xff0c;\u4e8b\u52a1\u5df2\u56de\u6eda\u201d&#xff0c;\u67e5\u8be2\u7ed3\u679c\u4e0e\u8f6c\u8d26\u524d\u4e00\u81f4\u3002<\/p>\n<h2>TRY-CATCH&#043;\u53cc\u91cd\u9519\u8bef\u6355\u83b7&#xff08;\u8f6c\u8d26\u6848\u4f8b)<\/h2>\n<p>\u7b14\u8bb0\u8bf4\u660e&#xff1a;\u6309\u201c\u57fa\u7840\u8bed\u6cd5\u793a\u4f8b\u2192\u6838\u5fc3\u6848\u4f8b\u62c6\u5206\u2192\u8003\u70b9\u89e3\u6790\u2192\u6613\u9519\u70b9\u603b\u7ed3\u201d\u7ed3\u6784\u6574\u7406&#xff0c;\u4fdd\u7559\u539f\u4ee3\u7801\u6838\u5fc3\u903b\u8f91&#xff0c;\u8865\u5145\u8be6\u7ec6\u6ce8\u91ca\u548c\u8003\u8bd5\u91cd\u70b9&#xff0c;\u9002\u914d\u671f\u672b\u590d\u4e60\u548c\u5b9e\u64cd\u8c03\u8bd5\u3002<\/p>\n<h3>\u4e00\u3001TRY-CATCH\u57fa\u7840\u8bed\u6cd5&#xff08;\u5165\u95e8\u793a\u4f8b&#xff09;<\/h3>\n<p>TRY-CATCH\u662fSQL Server\u7684\u5f02\u5e38\u6355\u83b7\u673a\u5236&#xff0c;\u7528\u4e8e\u6355\u83b7\u5e76\u5904\u7406\u6267\u884c\u8fc7\u7a0b\u4e2d\u7684\u9519\u8bef&#xff0c;\u66ff\u4ee3\u4f20\u7edf\u7684&#064;&#064;ERROR\u9010\u884c\u5224\u65ad&#xff0c;\u66f4\u9ad8\u6548\u3001\u66f4\u5168\u9762\u3002<\/p>\n<p>&#8212; \u793a\u4f8b1&#xff1a;\u57fa\u7840TRY-CATCH\u8bed\u6cd5&#xff08;\u5b57\u7b26\u8f6c\u6570\u5b57&#xff09;<br \/>\n&#8212; TRY\u5757&#xff1a;\u5b58\u653e\u53ef\u80fd\u51fa\u73b0\u9519\u8bef\u7684\u4ee3\u7801<br \/>\nbegin try<br \/>\n    declare &#064;i int<br \/>\n    set &#064;i &#061; cast(&#039;12&#039; as int) &#8212; \u6b63\u5e38\u8f6c\u6362&#xff0c;\u65e0\u9519\u8bef<br \/>\n    print &#064;i &#8212; \u8f93\u51fa&#xff1a;12<br \/>\nend try  <\/p>\n<p>&#8212; CATCH\u5757&#xff1a;\u5b58\u653e\u9519\u8bef\u5904\u7406\u4ee3\u7801&#xff0c;\u4ec5\u5f53TRY\u5757\u51fa\u73b0\u9519\u8bef\u65f6\u6267\u884c<br \/>\nbegin catch<br \/>\n    &#8212; raiserror&#xff1a;\u629b\u51fa\u81ea\u5b9a\u4e49\u9519\u8bef&#xff08;16\u4e3a\u666e\u901a\u9519\u8bef\u7b49\u7ea7&#xff0c;\u4e0d\u4f1a\u4e2d\u65ad\u6570\u636e\u5e93\u670d\u52a1&#xff09;<br \/>\n    raiserror(&#039;\u5b57\u7b26\u4e0d\u80fd\u8f6c\u6210\u6570\u5b57&#039;,16,1)<br \/>\n    print &#039;\u8f6c\u6362\u5931\u8d25&#039; &#8212; \u4ec5\u5f53\u8f6c\u6362\u51fa\u9519\u65f6\u624d\u4f1a\u6267\u884c<br \/>\nend catch<\/p>\n<p>\u6838\u5fc3\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>begin try&#8230;end try&#xff1a;\u5305\u88f9\u53ef\u80fd\u51fa\u73b0\u9519\u8bef\u7684\u4ee3\u7801&#xff0c;\u82e5\u4ee3\u7801\u6267\u884c\u65e0\u9519&#xff0c;\u8df3\u8fc7CATCH\u5757&#xff1b;\u82e5\u51fa\u9519&#xff0c;\u7acb\u5373\u8df3\u8f6c\u5230CATCH\u5757\u6267\u884c\u3002<\/p>\n<\/li>\n<li>\n<p>begin catch&#8230;end catch&#xff1a;\u5305\u88f9\u9519\u8bef\u5904\u7406\u4ee3\u7801&#xff0c;\u662f\u5f02\u5e38\u6355\u83b7\u7684\u201c\u5904\u7406\u533a\u201d\u3002<\/p>\n<\/li>\n<li>\n<p>raiserror&#xff1a;\u629b\u51fa\u81ea\u5b9a\u4e49\u9519\u8bef&#xff0c;\u53c2\u6570\u4f9d\u6b21\u4e3a\u300c\u9519\u8bef\u4fe1\u606f\u3001\u9519\u8bef\u7b49\u7ea7&#xff08;16\u4e3a\u5e38\u7528&#xff09;\u3001\u72b6\u6001\u7801\u300d&#xff0c;\u533a\u522b\u4e8e C# \u7684 throw\u2014\u2014\u4ec5\u629b\u51fa\u63d0\u793a&#xff0c;\u4e0d\u81ea\u52a8\u4e2d\u65ad\u7a0b\u5e8f&#xff0c;\u9700\u914d\u5408 return \u9000\u51fa\u3002<\/p>\n<\/li>\n<li>\n<p>\u533a\u522b\u4e8eC#\u7684throw&#xff1a;SQL\u4e2draiserror\u4ec5\u629b\u51fa\u9519\u8bef\u63d0\u793a&#xff0c;\u4e0d\u4f1a\u81ea\u52a8\u4e2d\u65ad\u7a0b\u5e8f&#xff0c;\u9700\u914d\u5408return\u9000\u51fa\u5b58\u50a8\u8fc7\u7a0b.<\/p>\n<\/li>\n<\/ul>\n<p>&#8212; \u793a\u4f8b2&#xff1a;\u4e8b\u52a1\u7ed3\u5408TRY-CATCH&#xff08;\u5220\u9664\u64cd\u4f5c&#xff09;<br \/>\nbegin tran &#8212; \u5f00\u542f\u4e8b\u52a1<br \/>\nbegin try<br \/>\n    &#8212; \u6267\u884c\u53ef\u80fd\u51fa\u9519\u7684\u5220\u9664\u64cd\u4f5c&#xff08;StudentId&#061;1000000\u5927\u6982\u7387\u4e0d\u5b58\u5728&#xff09;<br \/>\n    delete from StudentInfo where StudentId &#061; 1000000<br \/>\n    &#8212; \u82e5\u65e0\u9519\u8bef&#xff0c;\u63d0\u4ea4\u4e8b\u52a1<br \/>\n    commit tran<br \/>\n    print &#039;\u5220\u9664\u6210\u529f&#xff0c;\u4e8b\u52a1\u5df2\u63d0\u4ea4&#039;<br \/>\nend try<br \/>\nbegin catch<br \/>\n    &#8212; \u82e5\u6709\u9519\u8bef&#xff0c;\u56de\u6eda\u4e8b\u52a1<br \/>\n    print &#039;\u6267\u884c\u4efb\u610f\u4e00\u4e2a\u9519\u8bef\u5c31\u56de\u6eda&#039;<br \/>\n    rollback tran<br \/>\n    print &#039;\u4e8b\u52a1\u5df2\u56de\u6eda&#039;<br \/>\nend catch<\/p>\n<p>\u6838\u5fc3\u77e5\u8bc6\u70b9&#xff1a;\u4e8b\u52a1\u4e0e TRY-CATCH \u7ed3\u5408&#xff0c;\u5b9e\u73b0\u201c\u64cd\u4f5c\u6210\u529f\u5219\u63d0\u4ea4&#xff0c;\u64cd\u4f5c\u5931\u8d25\u5219\u56de\u6eda\u201d&#xff0c;\u907f\u514d\u4e8b\u52a1\u6b8b\u7559\u548c\u6570\u636e\u4e0d\u4e00\u81f4&#xff0c;\u662f\u8f6c\u8d26\u3001\u8ba2\u5355\u652f\u4ed8\u7b49\u573a\u666f\u7684\u6838\u5fc3\u7528\u6cd5\u3002<\/p>\n<h3>\u4e8c\u3001\u6838\u5fc3\u6848\u4f8b&#xff1a;\u8f6c\u8d26\u5b58\u50a8\u8fc7\u7a0b&#xff08;\u53cc\u91cd\u9519\u8bef\u6355\u83b7&#xff09;<\/h3>\n<p>\u672c\u6848\u4f8b\u901a\u8fc7\u300c\u4e1a\u52a1\u903b\u8f91\u524d\u7f6e\u5224\u65ad &#043; &#064;&#064;ERROR &#043; TRY-CATCH\u300d\u5b9e\u73b0\u53cc\u91cd\u9519\u8bef\u6355\u83b7&#xff0c;\u662f\u8003\u8bd5\u548c\u5b9e\u9645\u5f00\u53d1\u7684\u9ad8\u9891\u8003\u70b9&#xff0c;\u6838\u5fc3\u76ee\u6807\u662f\u4fdd\u8bc1\u8f6c\u8d26\u64cd\u4f5c\u7684\u539f\u5b50\u6027&#xff08;\u8f6c\u51fa\u3001\u8f6c\u5165\u8981\u4e48\u5168\u6210\u529f&#xff0c;\u8981\u4e48\u5168\u5931\u8d25&#xff09;\u3002<\/p>\n<h4>\u6a21\u57571&#xff1a;\u5220\u9664\u539f\u6709\u5b58\u50a8\u8fc7\u7a0b&#xff08;\u907f\u514d\u91cd\u590d\u521b\u5efa&#xff09;<\/h4>\n<p>&#8212; \u5224\u65ad\u5b58\u50a8\u8fc7\u7a0btest01\u662f\u5426\u5b58\u5728&#xff0c;\u82e5\u5b58\u5728\u5219\u5220\u9664<br \/>\nif exists (select * from sysobjects where name &#061; &#039;test01&#039;)<br \/>\n    drop proc test01;<br \/>\ngo<\/p>\n<p>\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>\n<p>sysobjects&#xff1a;SQL Server \u7cfb\u7edf\u8868&#xff0c;\u5b58\u50a8\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61&#xff08;\u5b58\u50a8\u8fc7\u7a0b\u3001\u8868\u3001\u89c6\u56fe\u7b49&#xff09;\u7684\u4fe1\u606f\u3002<\/p>\n<\/li>\n<li>\n<p>go&#xff1a;\u6279\u5904\u7406\u7ed3\u675f\u6807\u8bb0&#xff0c;\u5c06\u524d\u540e\u4ee3\u7801\u5206\u9694\u4e3a\u72ec\u7acb\u7684\u6267\u884c\u6279\u6b21&#xff0c;\u907f\u514d\u8bed\u6cd5\u62a5\u9519\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>\u6a21\u57572&#xff1a;\u521b\u5efa\u5b58\u50a8\u8fc7\u7a0b&#xff08;\u6838\u5fc3\u4ee3\u7801&#xff0c;\u62c6\u5206\u8be6\u89e3&#xff09;<\/h4>\n<p>&#8212; \u521b\u5efa\u8f6c\u8d26\u5b58\u50a8\u8fc7\u7a0btest01<br \/>\ncreate proc test01<br \/>\n    &#064;inAccount int,   &#8212; \u5165\u8d26\u8d26\u53f7&#xff08;\u63a5\u6536\u65b9&#xff09;<br \/>\n    &#064;outAccount int,  &#8212; \u51fa\u8d26\u8d26\u53f7&#xff08;\u8f6c\u51fa\u65b9&#xff09;<br \/>\n    &#064;jine int         &#8212; \u8f6c\u8d26\u91d1\u989d<br \/>\nas<br \/>\nbegin<br \/>\n    SET NOCOUNT ON; &#8212; \u5173\u95ed\u8ba1\u6570\u6d88\u606f&#xff0c;\u63d0\u5347\u6267\u884c\u6548\u7387<\/p>\n<p>    &#8212; \u5b9a\u4e49\u53d8\u91cf&#xff1a;\u7edf\u8ba1SQL\u6267\u884c\u9519\u8bef\u4e2a\u6570&#xff08;0&#061;\u65e0\u9519&#xff0c;\u975e0&#061;\u6709\u9519&#xff09;<br \/>\n    declare &#064;errorNum int;<br \/>\n    set &#064;errorNum &#061; 0;<\/p>\n<p>    &#8212; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u7b2c\u4e00\u5c42&#xff1a;\u4e1a\u52a1\u903b\u8f91\u524d\u7f6e\u5224\u65ad&#xff08;\u63d0\u524d\u62e6\u622a\u65e0\u6548\u8bf7\u6c42&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n    &#8212; 1. \u5224\u65ad\u8f6c\u8d26\u91d1\u989d\u662f\u5426\u5408\u6cd5&#xff08;\u91d1\u989d\u5fc5\u987b\u5927\u4e8e0&#xff09;<br \/>\n    if(&#064;jine &lt;&#061; 0)<br \/>\n    begin<br \/>\n        raiserror(&#039;\u8f6c\u8d26\u7684\u91d1\u989d\u4e0d\u5408\u6cd5&#039;,16,1); &#8212; \u629b\u51fa\u4e1a\u52a1\u9519\u8bef<br \/>\n        return; &#8212; \u9000\u51fa\u5b58\u50a8\u8fc7\u7a0b&#xff0c;\u4e0d\u6267\u884c\u540e\u7eed\u64cd\u4f5c<br \/>\n    end<\/p>\n<p>    &#8212; 2. \u5224\u65ad\u8f6c\u51fa\u8d26\u6237\u662f\u5426\u5b58\u5728&#xff08;exists&#043;select 1&#xff1a;\u9ad8\u6548\u5224\u65ad\u8bb0\u5f55\u662f\u5426\u5b58\u5728&#xff09;<br \/>\n    if not exists (select 1 from CardNew where StdudentId &#061; &#064;outAccount)<br \/>\n    begin<br \/>\n        raiserror(&#039;\u8f6c\u51fa\u8d26\u6237\u4e0d\u5b58\u5728&#039;,16,1);<br \/>\n        return;<br \/>\n    end<\/p>\n<p>    &#8212; 3. \u5224\u65ad\u8f6c\u5165\u8d26\u6237\u662f\u5426\u5b58\u5728<br \/>\n    if not exists (select 1 from CardNew where StdudentId &#061; &#064;inAccount)<br \/>\n    begin<br \/>\n        raiserror(&#039;\u8f6c\u5165\u8d26\u6237\u4e0d\u5b58\u5728&#039;,16,1);<br \/>\n        return;<br \/>\n    end<\/p>\n<p>    &#8212; 4. \u5224\u65ad\u8f6c\u51fa\u8d26\u6237\u4f59\u989d\u662f\u5426\u5145\u8db3&#xff08;\u53ef\u9009&#xff0c;\u539f\u4ee3\u7801\u6ce8\u91ca&#xff0c;\u5efa\u8bae\u5f00\u542f&#xff09;<br \/>\n    declare &#064;outMoney money; &#8212; \u5b58\u50a8\u8f6c\u51fa\u8d26\u6237\u5f53\u524d\u4f59\u989d<br \/>\n    select &#064;outMoney &#061; CurrentMoney from CardNew where StdudentId &#061; &#064;outAccount;<br \/>\n    if(&#064;outMoney &#8211; &#064;jine &lt;&#061; 1) &#8212; \u6263\u9664\u540e\u9700\u6ee1\u8db3CardNew\u8868\u7684check\u7ea6\u675f&#xff08;\u4f59\u989d&gt;1&#xff09;<br \/>\n    begin<br \/>\n        raiserror(&#039;\u4f59\u989d\u4e0d\u8db3&#039;,16,1);<br \/>\n        return;<br \/>\n    end<\/p>\n<p>    &#8212; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061; \u7b2c\u4e8c\u5c42&#xff1a;\u4e8b\u52a1&#043;\u53cc\u91cd\u9519\u8bef\u6355\u83b7&#xff08;\u6267\u884c\u8f6c\u8d26\u64cd\u4f5c&#xff09; &#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;<br \/>\n    begin tran; &#8212; \u5f00\u542f\u4e8b\u52a1&#xff0c;\u540e\u7eed\u64cd\u4f5c\u7eb3\u5165\u4e8b\u52a1\u7ba1\u7406<\/p>\n<p>    begin try<br \/>\n        &#8212; 1. \u8f6c\u51fa\u903b\u8f91&#xff1a;\u4ece\u51fa\u8d26\u8d26\u53f7\u6263\u9664\u6307\u5b9a\u91d1\u989d<br \/>\n        update CardNew<br \/>\n        set CurrentMoney &#061; CurrentMoney &#8211; &#064;jine<br \/>\n        where StdudentId &#061; &#064;outAccount;<\/p>\n<p>        &#8212; \u8bb0\u5f55\u8f6c\u51fa\u64cd\u4f5c\u7684\u9519\u8bef\u7801&#xff08;&#064;&#064;ERROR&#xff1a;\u4e0a\u4e00\u6761SQL\u7684\u9519\u8bef\u7801&#xff09;<br \/>\n        set &#064;errorNum &#061; &#064;errorNum &#043; &#064;&#064;ERROR;<\/p>\n<p>        &#8212; 2. \u8f6c\u5165\u903b\u8f91&#xff1a;\u5411\u5165\u8d26\u8d26\u53f7\u589e\u52a0\u6307\u5b9a\u91d1\u989d<br \/>\n        update CardNew<br \/>\n        set CurrentMoney &#061; CurrentMoney &#043; &#064;jine<br \/>\n        where StdudentId &#061; &#064;inAccount;<\/p>\n<p>        &#8212; \u8bb0\u5f55\u8f6c\u5165\u64cd\u4f5c\u7684\u9519\u8bef\u7801&#xff0c;\u7d2f\u8ba1\u9519\u8bef\u4e2a\u6570<br \/>\n        set &#064;errorNum &#061; &#064;errorNum &#043; &#064;&#064;ERROR;<\/p>\n<p>        &#8212; 3. \u7b2c\u4e00\u5c42\u6355\u83b7&#xff08;&#064;&#064;ERROR&#xff09;&#xff1a;\u5224\u65adSQL\u6267\u884c\u662f\u5426\u51fa\u9519<br \/>\n        if(&#064;errorNum &gt; 0)<br \/>\n        begin<br \/>\n            print &#039;\u68c0\u6d4b\u5230SQL\u6267\u884c\u9519\u8bef&#xff0c;\u89e6\u53d1\u56de\u6eda&#039;;<br \/>\n            raiserror(&#039;sql\u6267\u884c\u51fa\u9519&#xff0c;\u4e8b\u52a1\u5df2\u7ecf\u56de\u6eda&#039;,16,1);<br \/>\n            rollback transaction; &#8212; \u56de\u6eda\u4e8b\u52a1<br \/>\n            return;<br \/>\n        end<br \/>\n        else<br \/>\n        begin<br \/>\n            commit transaction; &#8212; \u65e0\u9519\u8bef&#xff0c;\u63d0\u4ea4\u4e8b\u52a1<br \/>\n            print &#039;\u8f6c\u8d26\u6210\u529f&#xff0c;\u4e8b\u52a1\u5df2\u63d0\u4ea4&#039;;<br \/>\n        end<br \/>\n    end try<\/p>\n<p>    begin catch<br \/>\n        &#8212; \u7b2c\u4e8c\u5c42\u6355\u83b7&#xff08;TRY-CATCH&#xff09;&#xff1a;\u6355\u83b7TRY\u5757\u4e2d\u672a\u88ab&#064;&#064;ERROR\u62e6\u622a\u7684\u4e25\u91cd\u9519\u8bef<br \/>\n        &#8212; &#064;&#064;TRANCOUNT&#xff1a;\u5168\u5c40\u53d8\u91cf&#xff0c;\u8fd4\u56de\u5f53\u524d\u4f1a\u8bdd\u672a\u63d0\u4ea4\u7684\u4e8b\u52a1\u6570\u91cf&#xff0c;\u907f\u514d\u91cd\u590d\u56de\u6eda\u62a5\u9519<br \/>\n        if(&#064;&#064;TRANCOUNT &gt; 0)<br \/>\n        begin<br \/>\n            rollback tran; &#8212; \u56de\u6eda\u6240\u6709\u672a\u63d0\u4ea4\u7684\u64cd\u4f5c<br \/>\n            print &#039;\u53ef\u63d0\u4ea4\u7684\u4e8b\u52a1 \u56de\u6eda&#039;;<br \/>\n        end<br \/>\n        return; &#8212; \u9000\u51fa\u5b58\u50a8\u8fc7\u7a0b<br \/>\n    end catch<\/p>\n<p>    SET NOCOUNT OFF; &#8212; \u6062\u590d\u8ba1\u6570\u6d88\u606f<br \/>\nend<br \/>\ngo<\/p>\n<h4>\u6a21\u57573&#xff1a;\u6d4b\u8bd5\u5b58\u50a8\u8fc7\u7a0b<\/h4>\n<p>&#8212; \u6d4b\u8bd5\u573a\u666f&#xff1a;\u6b63\u5e38\u8f6c\u8d26&#xff08;\u524d\u63d0&#xff1a;1003\u30011002\u8d26\u53f7\u5b58\u5728&#xff0c;\u4e141002\u4f59\u989d\u5145\u8db3&#xff09;<br \/>\nexec test01 1003, 1002, 1000; &#8212; \u5165\u8d261003&#xff0c;\u51fa\u8d261002&#xff0c;\u8f6c\u8d261000\u5143<br \/>\nselect * from CardNew; &#8212; \u67e5\u8be2\u8f6c\u8d26\u540e\u6570\u636e&#xff0c;\u9a8c\u8bc1\u4f59\u989d\u53d8\u5316<\/p>\n<h3>\u4e09\u3001\u6838\u5fc3\u8003\u70b9\u89e3\u6790&#xff08;\u5fc5\u80cc&#xff0c;\u9002\u914d\u7b80\u7b54\/\u586b\u7a7a&#xff09;<\/h3>\n<h4>1. \u53cc\u91cd\u9519\u8bef\u6355\u83b7\u7684\u6838\u5fc3\u903b\u8f91&#xff08;\u7b80\u7b54\u9898\u91cd\u70b9&#xff09;<\/h4>\n<p>\u672c\u6848\u4f8b\u901a\u8fc7\u201c\u4e09\u5c42\u9632\u62a4\u201d\u4fdd\u8bc1\u8f6c\u8d26\u64cd\u4f5c\u7684\u5b89\u5168\u6027\u548c\u6570\u636e\u4e00\u81f4\u6027&#xff0c;\u6838\u5fc3\u903b\u8f91\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7b2c\u4e00\u5c42&#xff1a;\u4e1a\u52a1\u903b\u8f91\u524d\u7f6e\u5224\u65ad&#xff1a;\u5728\u5f00\u542f\u4e8b\u52a1\u524d&#xff0c;\u901a\u8fc7 if&#043;exists&#043;raiserror&#043;return \u62e6\u622a\u65e0\u6548\u8bf7\u6c42&#xff08;\u91d1\u989d\u975e\u6cd5\u3001\u8d26\u53f7\u4e0d\u5b58\u5728\u3001\u4f59\u989d\u4e0d\u8db3&#xff09;&#xff0c;\u4ece\u6e90\u5934\u907f\u514d\u65e0\u6548\u64cd\u4f5c&#xff0c;\u51cf\u5c11\u4e8b\u52a1\u5f00\u542f\u6b21\u6570&#xff0c;\u63d0\u5347\u6267\u884c\u6548\u7387\u3002<\/p>\n<\/li>\n<li>\n<p>\u7b2c\u4e8c\u5c42&#xff1a;&#064;&#064;ERROR \u6355\u83b7&#xff1a;\u6267\u884c\u8f6c\u8d26 SQL \u540e&#xff0c;\u901a\u8fc7 &#064;&#064;ERROR \u7edf\u8ba1\u9519\u8bef\u4e2a\u6570&#xff0c;\u6355\u83b7 SQL \u6267\u884c\u5c42\u9762\u7684\u666e\u901a\u9519\u8bef&#xff08;\u5982\u7ea6\u675f\u51b2\u7a81\u3001\u8bed\u6cd5\u9519\u8bef&#xff09;&#xff0c;\u4e00\u65e6\u68c0\u6d4b\u5230\u9519\u8bef&#xff0c;\u7acb\u5373\u56de\u6eda\u4e8b\u52a1\u3002<\/p>\n<\/li>\n<li>\n<p>\u7b2c\u4e09\u5c42&#xff1a;TRY-CATCH \u6355\u83b7&#xff1a;\u6355\u83b7 TRY \u5757\u4e2d\u672a\u88ab &#064;&#064;ERROR \u62e6\u622a\u7684\u4e25\u91cd\u9519\u8bef&#xff08;\u5982\u6b7b\u9501\u3001\u6570\u636e\u5e93\u8fde\u63a5\u5f02\u5e38\u3001\u6743\u9650\u4e0d\u8db3&#xff09;&#xff0c;\u786e\u4fdd\u65e0\u8bba\u51fa\u73b0\u4f55\u79cd\u9519\u8bef&#xff0c;\u90fd\u80fd\u56de\u6eda\u4e8b\u52a1&#xff0c;\u907f\u514d\u4e8b\u52a1\u6b8b\u7559\u548c\u6570\u636e\u4e0d\u4e00\u81f4\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u5173\u952e\u5168\u5c40\u53d8\u91cf&#xff08;\u9009\u62e9\u9898\/\u586b\u7a7a\u9898\u91cd\u70b9&#xff09;<\/h4>\n<ul>\n<li>\n<p>&#064;&#064;ERROR&#xff1a;\u8fd4\u56de\u4e0a\u4e00\u6761 SQL \u8bed\u53e5\u7684\u9519\u8bef\u7801&#xff0c;0 \u8868\u793a\u65e0\u9519\u8bef&#xff0c;\u975e 0 \u8868\u793a\u6709\u9519\u8bef&#xff1b;\u6613\u9519\u70b9&#xff1a;\u4ec5\u8fd4\u56de\u201c\u4e0a\u4e00\u6761\u201dSQL \u7684\u9519\u8bef\u7801&#xff0c;\u9700\u6bcf\u6b21\u64cd\u4f5c\u540e\u7acb\u5373\u7d2f\u52a0&#xff0c;\u5426\u5219\u4f1a\u88ab\u540e\u7eed\u64cd\u4f5c\u8986\u76d6\u3002<\/p>\n<\/li>\n<li>\n<p>&#064;&#064;TRANCOUNT&#xff1a;\u8fd4\u56de\u5f53\u524d\u4f1a\u8bdd\u4e2d\u672a\u63d0\u4ea4\u7684\u4e8b\u52a1\u6570\u91cf&#xff0c;\u7528\u4e8e\u5224\u65ad\u662f\u5426\u9700\u8981\u56de\u6eda&#xff1b;\u6838\u5fc3\u4f5c\u7528&#xff1a;\u907f\u514d\u201c\u65e0\u4e8b\u52a1\u53ef\u56de\u6eda\u201d\u62a5\u9519&#xff0c;\u662f\u4e8b\u52a1\u5f02\u5e38\u5904\u7406\u7684\u5fc5\u5907\u5224\u65ad\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>3. \u4e8b\u52a1\u4e0e TRY-CATCH \u7ed3\u5408\u7684\u6838\u5fc3\u539f\u5219<\/h4>\n<p>\u4e8b\u52a1\u7684\u6838\u5fc3\u662f\u201c\u539f\u5b50\u6027\u201d&#xff0c;\u7ed3\u5408 TRY-CATCH \u65f6\u9700\u9075\u5faa\u4ee5\u4e0b\u539f\u5219&#xff0c;\u5426\u5219\u4f1a\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4e8b\u52a1\u5728 TRY \u5757\u5916\u5f00\u542f&#xff0c;\u786e\u4fdd TRY-CATCH \u80fd\u8986\u76d6\u6574\u4e2a\u4e8b\u52a1\u6d41\u7a0b&#xff08;\u82e5\u5728 TRY \u5757\u5185\u5f00\u542f&#xff0c;\u4e25\u91cd\u9519\u8bef\u53ef\u80fd\u5bfc\u81f4\u4e8b\u52a1\u672a\u88ab\u56de\u6eda&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>TRY \u5757\u5185\u6267\u884c\u6838\u5fc3\u4e1a\u52a1\u64cd\u4f5c&#xff0c;\u65e0\u9519\u5219\u63d0\u4ea4\u4e8b\u52a1&#xff1b;\u6709\u9519\u5219\u901a\u8fc7 &#064;&#064;ERROR \u89e6\u53d1\u56de\u6eda\u3002<\/p>\n<\/li>\n<li>\n<p>CATCH \u5757\u5185\u5fc5\u987b\u5224\u65ad\u4e8b\u52a1\u72b6\u6001&#xff08;&#064;&#064;TRANCOUNT&gt;0&#xff09;&#xff0c;\u786e\u4fdd\u56de\u6eda\u6240\u6709\u672a\u63d0\u4ea4\u64cd\u4f5c&#xff0c;\u907f\u514d\u4e8b\u52a1\u6b8b\u7559\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u56db\u3001\u6613\u9519\u70b9\u603b\u7ed3&#xff08;\u8003\u8bd5\u907f\u5751\u91cd\u70b9&#xff09;<\/h3>\n<h4>1. \u539f\u4ee3\u7801\u6613\u9519\u70b9<\/h4>\n<ul>\n<li>\n<p>\u4f59\u989d\u5224\u65ad\u88ab\u6ce8\u91ca&#xff1a;\u539f\u4ee3\u7801\u4e2d\u672a\u5f00\u542f\u4f59\u989d\u5224\u65ad&#xff0c;\u82e5\u51fa\u8d26\u8d26\u53f7\u4f59\u989d\u4e0d\u8db3&#xff0c;\u4f1a\u89e6\u53d1 CardNew \u8868\u7684 check \u7ea6\u675f\u62a5\u9519&#xff0c;\u5efa\u8bae\u5f00\u542f\u4ee5\u63d0\u524d\u62e6\u622a&#xff0c;\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u5c11\u9519\u8bef\u8be6\u7ec6\u4fe1\u606f&#xff1a;CATCH \u5757\u4e2d\u672a\u8f93\u51fa\u9519\u8bef\u7f16\u53f7\u548c\u63cf\u8ff0&#xff0c;\u4e0d\u5229\u4e8e\u8c03\u8bd5&#xff0c;\u5efa\u8bae\u6dfb\u52a0\u9519\u8bef\u76f8\u5173\u51fd\u6570&#xff08;\u89c1\u4e0b\u6587\u8865\u5145\u4f18\u5316&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u63d0\u793a\u4fe1\u606f\u4e0d\u6e05\u6670&#xff1a;\u539f\u4ee3\u7801\u4e2d\u201cddddddddddddddddddd\u201d\u65e0\u5b9e\u9645\u610f\u4e49&#xff0c;\u5efa\u8bae\u66ff\u6362\u4e3a\u660e\u786e\u7684\u9519\u8bef\u63d0\u793a&#xff0c;\u4fbf\u4e8e\u6d4b\u8bd5\u548c\u8c03\u8bd5\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2. \u5f00\u53d1\/\u8003\u8bd5\u9ad8\u9891\u6613\u9519\u573a\u666f<\/h4>\n<ul>\n<li>\n<p>\u5fd8\u8bb0\u6dfb\u52a0 return&#xff1a;raiserror \u4ec5\u629b\u51fa\u9519\u8bef\u63d0\u793a&#xff0c;\u4e0d\u4f1a\u81ea\u52a8\u4e2d\u65ad\u7a0b\u5e8f&#xff0c;\u82e5\u7f3a\u5c11 return&#xff0c;\u4f1a\u7ee7\u7eed\u6267\u884c\u540e\u7eed\u4ee3\u7801&#xff0c;\u5bfc\u81f4\u65e0\u6548\u4e8b\u52a1\u5f00\u542f\u3002<\/p>\n<\/li>\n<li>\n<p>&#064;&#064;ERROR \u4f7f\u7528\u4e0d\u5f53&#xff1a;\u672a\u5728\u6bcf\u4e2a SQL \u64cd\u4f5c\u540e\u7acb\u5373\u7d2f\u52a0&#xff0c;\u5bfc\u81f4\u9519\u8bef\u7801\u88ab\u540e\u7eed\u64cd\u4f5c\u8986\u76d6&#xff0c;\u65e0\u6cd5\u6b63\u786e\u7edf\u8ba1\u9519\u8bef\u4e2a\u6570&#xff0c;\u8fdb\u800c\u5bfc\u81f4\u4e8b\u52a1\u672a\u56de\u6eda\u3002<\/p>\n<\/li>\n<li>\n<p>\u91cd\u590d\u56de\u6eda\u4e8b\u52a1&#xff1a;\u672a\u901a\u8fc7 &#064;&#064;TRANCOUNT \u5224\u65ad\u4e8b\u52a1\u72b6\u6001&#xff0c;\u82e5\u4e8b\u52a1\u5df2\u63d0\u4ea4&#xff0c;\u6267\u884c rollback \u4f1a\u89e6\u53d1\u201c\u65e0\u4e8b\u52a1\u53ef\u56de\u6eda\u201d\u62a5\u9519&#xff0c;\u662f\u8003\u8bd5\u548c\u5f00\u53d1\u7684\u9ad8\u9891\u6613\u9519\u70b9\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e94\u3001\u8865\u5145\u4f18\u5316&#xff08;\u63d0\u5347\u5065\u58ee\u6027&#xff0c;\u8003\u8bd5\u52a0\u5206\u9879&#xff09;<\/h3>\n<p>\u5728 CATCH \u5757\u4e2d\u6dfb\u52a0\u9519\u8bef\u8be6\u7ec6\u4fe1\u606f\u8f93\u51fa&#xff0c;\u4fbf\u4e8e\u8c03\u8bd5\u548c\u9519\u8bef\u6392\u67e5&#xff0c;\u662f\u8003\u8bd5\u52a0\u5206\u9879&#xff0c;\u4e5f\u662f\u5b9e\u9645\u5f00\u53d1\u7684\u5fc5\u5907\u64cd\u4f5c&#xff1a;<\/p>\n<p>begin catch<br \/>\n    if(&#064;&#064;TRANCOUNT &gt; 0)<br \/>\n    begin<br \/>\n        rollback tran;<br \/>\n        print &#039;\u53ef\u63d0\u4ea4\u7684\u4e8b\u52a1 \u56de\u6eda&#039;;<br \/>\n    end<br \/>\n    &#8212; \u8f93\u51fa\u9519\u8bef\u8be6\u7ec6\u4fe1\u606f&#xff08;\u8003\u8bd5\u52a0\u5206\u9879&#xff09;<br \/>\n    print &#039;\u9519\u8bef\u7f16\u53f7&#xff1a;&#039; &#043; CAST(ERROR_NUMBER() as varchar);<br \/>\n    print &#039;\u9519\u8bef\u63cf\u8ff0&#xff1a;&#039; &#043; ERROR_MESSAGE();<br \/>\n    print &#039;\u9519\u8bef\u4e25\u91cd\u7b49\u7ea7&#xff1a;&#039; &#043; CAST(ERROR_SEVERITY() as varchar);<br \/>\n    return;<br \/>\nend catch<\/p>\n<p>\u8865\u5145\u8bf4\u660e&#xff1a;ERROR_NUMBER()&#xff08;\u9519\u8bef\u7f16\u53f7&#xff09;\u3001ERROR_MESSAGE()&#xff08;\u9519\u8bef\u63cf\u8ff0&#xff09;\u3001ERROR_SEVERITY()&#xff08;\u9519\u8bef\u7b49\u7ea7&#xff09;\u662f CATCH \u5757\u4e13\u7528\u51fd\u6570&#xff0c;\u4ec5\u5728 CATCH \u5757\u5185\u6709\u6548\u3002<\/p>\n<h3>\u516d\u3001\u6d4b\u8bd5\u7ed3\u679c\u5206\u6790<\/h3>\n<h4>\u573a\u666f1&#xff1a;\u6b63\u5e38\u8f6c\u8d26&#xff08;\u8d26\u53f7\u5b58\u5728\u3001\u91d1\u989d\u5408\u6cd5\u3001\u4f59\u989d\u5145\u8db3&#xff09;<\/h4>\n<p>\u6267\u884c\u7ed3\u679c&#xff1a;\u51fa\u8d26\u8d26\u53f71002\u4f59\u989d\u51cf\u5c111000\u5143&#xff0c;\u5165\u8d26\u8d26\u53f71003\u4f59\u989d\u589e\u52a01000\u5143&#xff0c;\u4e8b\u52a1\u63d0\u4ea4&#xff0c;\u6253\u5370\u201c\u8f6c\u8d26\u6210\u529f&#xff0c;\u4e8b\u52a1\u5df2\u63d0\u4ea4\u201d&#xff0c;\u67e5\u8be2 CardNew \u8868&#xff0c;\u6570\u636e\u4e0e\u9884\u671f\u4e00\u81f4\u3002<\/p>\n<h4>\u573a\u666f2&#xff1a;\u5f02\u5e38\u573a\u666f&#xff08;\u5982\u4f59\u989d\u4e0d\u8db3&#xff09;<\/h4>\n<p>\u6267\u884c\u7ed3\u679c&#xff1a;\u89e6\u53d1\u4e1a\u52a1\u903b\u8f91\u5224\u65ad&#xff0c;\u629b\u51fa\u201c\u4f59\u989d\u4e0d\u8db3\u201d\u9519\u8bef&#xff0c;\u6267\u884c return \u9000\u51fa\u5b58\u50a8\u8fc7\u7a0b&#xff0c;\u4e8b\u52a1\u672a\u5f00\u542f&#xff0c;CardNew \u8868\u6570\u636e\u65e0\u53d8\u5316&#xff1b;\u82e5\u672a\u5f00\u542f\u4f59\u989d\u5224\u65ad&#xff0c;\u4f1a\u89e6\u53d1 check \u7ea6\u675f\u62a5\u9519&#xff0c;&#064;&#064;ERROR \u6355\u83b7\u9519\u8bef&#xff0c;\u89e6\u53d1\u4e8b\u52a1\u56de\u6eda&#xff0c;\u6570\u636e\u4ecd\u65e0\u53d8\u5316&#xff0c;\u4fdd\u8bc1\u4e86\u6570\u636e\u4e00\u81f4\u6027\u3002<\/p>\n<h4>\u573a\u666f3&#xff1a;\u4e25\u91cd\u9519\u8bef&#xff08;\u5982\u6b7b\u9501&#xff09;<\/h4>\n<p>\u6267\u884c\u7ed3\u679c&#xff1a;TRY \u5757\u4e2d\u7684\u4ee3\u7801\u88ab\u4e2d\u65ad&#xff0c;\u76f4\u63a5\u8df3\u8f6c\u5230 CATCH \u5757&#xff0c;\u5224\u65ad &#064;&#064;TRANCOUNT&gt;0 \u540e\u56de\u6eda\u4e8b\u52a1&#xff0c;\u6253\u5370\u201c\u53ef\u63d0\u4ea4\u7684\u4e8b\u52a1 \u56de\u6eda\u201d&#xff0c;\u6570\u636e\u65e0\u53d8\u5316&#xff0c;\u907f\u514d\u4e8b\u52a1\u6b8b\u7559\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b14\u8bb0\u8bf4\u660e&#xff1a;\u6309\u201c\u529f\u80fd\u6982\u8ff0\u2192\u4ee3\u7801\u62c6\u5206\u2192\u6838\u5fc3\u77e5\u8bc6\u70b9\u2192\u6ce8\u610f\u4e8b\u9879\u2192\u6d4b\u8bd5\u5206\u6790\u201d\u7ed3\u6784\u6574\u7406&#xff0c;\u4fdd\u7559\u539f\u4ee3\u7801\u6838\u5fc3\u903b\u8f91&#xff0c;\u8865\u5145\u8be6\u7ec6\u6ce8\u91ca\u548c\u8003\u70b9\u89e3\u6790&#xff0c;\u9002\u914d\u671f\u672b\u590d\u4e60\u548c\u5b9e\u64cd\u8c03\u8bd5\u3002\u4e00\u3001\u529f\u80fd\u6982\u8ff0\u672c\u6848\u4f8b\u901a\u8fc7**\u5b58\u50a8\u8fc7\u7a0b\u4e8b\u52a1**\u5b9e\u73b0\u94f6\u884c\u5361\u8f6c\u8d26\u529f\u80fd&#xff0c;\u6838\u5fc3\u76ee\u6807\u662f\u4fdd\u8bc1\u8f6c\u8d26\u64cd\u4f5c\u7684\u539f\u5b50\u6027&#xff08;\u8f6c\u51fa\u548c\u8f6c\u5165\u8981\u4e48\u5168\u6210\u529f&#xff0c;\u8981\u4e48\u5168\u5931\u8d25&#xff09;&#xff0c;\u907f\u514d\u56e0\u90e8\u5206\u64cd\u4f5c\u5931\u8d25\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4&#xff08;\u5982\u94b1\u8f6c\u51fa\u6210\u529f\u4f46\u8f6c\u5165\u5931\u8d25&amp;#xff<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[604,100],"topic":[],"class_list":["post-88627","post","type-post","status-publish","format-standard","hentry","category-server","tag-oracle","tag-100"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/88627.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u7b14\u8bb0\u8bf4\u660e&#xff1a;\u6309\u201c\u529f\u80fd\u6982\u8ff0\u2192\u4ee3\u7801\u62c6\u5206\u2192\u6838\u5fc3\u77e5\u8bc6\u70b9\u2192\u6ce8\u610f\u4e8b\u9879\u2192\u6d4b\u8bd5\u5206\u6790\u201d\u7ed3\u6784\u6574\u7406&#xff0c;\u4fdd\u7559\u539f\u4ee3\u7801\u6838\u5fc3\u903b\u8f91&#xff0c;\u8865\u5145\u8be6\u7ec6\u6ce8\u91ca\u548c\u8003\u70b9\u89e3\u6790&#xff0c;\u9002\u914d\u671f\u672b\u590d\u4e60\u548c\u5b9e\u64cd\u8c03\u8bd5\u3002\u4e00\u3001\u529f\u80fd\u6982\u8ff0\u672c\u6848\u4f8b\u901a\u8fc7**\u5b58\u50a8\u8fc7\u7a0b\u4e8b\u52a1**\u5b9e\u73b0\u94f6\u884c\u5361\u8f6c\u8d26\u529f\u80fd&#xff0c;\u6838\u5fc3\u76ee\u6807\u662f\u4fdd\u8bc1\u8f6c\u8d26\u64cd\u4f5c\u7684\u539f\u5b50\u6027&#xff08;\u8f6c\u51fa\u548c\u8f6c\u5165\u8981\u4e48\u5168\u6210\u529f&#xff0c;\u8981\u4e48\u5168\u5931\u8d25&#xff09;&#xff0c;\u907f\u514d\u56e0\u90e8\u5206\u64cd\u4f5c\u5931\u8d25\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4&#xff08;\u5982\u94b1\u8f6c\u51fa\u6210\u529f\u4f46\u8f6c\u5165\u5931\u8d25&amp;#xff\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/88627.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-01T06:16:31+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/88627.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/88627.html\",\"name\":\"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-01T06:16:31+00:00\",\"dateModified\":\"2026-08-01T06:16:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/88627.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/88627.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/88627.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/88627.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u7b14\u8bb0\u8bf4\u660e&#xff1a;\u6309\u201c\u529f\u80fd\u6982\u8ff0\u2192\u4ee3\u7801\u62c6\u5206\u2192\u6838\u5fc3\u77e5\u8bc6\u70b9\u2192\u6ce8\u610f\u4e8b\u9879\u2192\u6d4b\u8bd5\u5206\u6790\u201d\u7ed3\u6784\u6574\u7406&#xff0c;\u4fdd\u7559\u539f\u4ee3\u7801\u6838\u5fc3\u903b\u8f91&#xff0c;\u8865\u5145\u8be6\u7ec6\u6ce8\u91ca\u548c\u8003\u70b9\u89e3\u6790&#xff0c;\u9002\u914d\u671f\u672b\u590d\u4e60\u548c\u5b9e\u64cd\u8c03\u8bd5\u3002\u4e00\u3001\u529f\u80fd\u6982\u8ff0\u672c\u6848\u4f8b\u901a\u8fc7**\u5b58\u50a8\u8fc7\u7a0b\u4e8b\u52a1**\u5b9e\u73b0\u94f6\u884c\u5361\u8f6c\u8d26\u529f\u80fd&#xff0c;\u6838\u5fc3\u76ee\u6807\u662f\u4fdd\u8bc1\u8f6c\u8d26\u64cd\u4f5c\u7684\u539f\u5b50\u6027&#xff08;\u8f6c\u51fa\u548c\u8f6c\u5165\u8981\u4e48\u5168\u6210\u529f&#xff0c;\u8981\u4e48\u5168\u5931\u8d25&#xff09;&#xff0c;\u907f\u514d\u56e0\u90e8\u5206\u64cd\u4f5c\u5931\u8d25\u5bfc\u81f4\u6570\u636e\u4e0d\u4e00\u81f4&#xff08;\u5982\u94b1\u8f6c\u51fa\u6210\u529f\u4f46\u8f6c\u5165\u5931\u8d25&amp;#xff","og_url":"https:\/\/www.wsisp.com\/helps\/88627.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-01T06:16:31+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/88627.html","url":"https:\/\/www.wsisp.com\/helps\/88627.html","name":"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-01T06:16:31+00:00","dateModified":"2026-08-01T06:16:31+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/88627.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/88627.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/88627.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4e8b\u52a1+\u5b58\u50a8\u8fc7\u7a0b\u8f6c\u8d26\u529f\u80fd"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/88627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=88627"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/88627\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=88627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=88627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=88627"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=88627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}