Heim  >  Artikel  >  Backend-Entwicklung  >  phpMyAdmin平添存储过程

phpMyAdmin平添存储过程

WBOY
WBOYOriginal
2016-06-13 10:48:53966Durchsuche

phpMyAdmin添加存储过程

存储过程:

?

CREATE PROCEDURE `ClearCoupon`()BEGIN     declare today int(16);            select UNIX_TIMESTAMP(curdate()) into today;          UPDATE coupon SET status=0 WHERE endtime<today><p>?</p>
<p>?copy到phpmyadmin里面执行,就报错了</p>
<p><span style="font-size: 13px; background-color: #f5f5f5;"><div class="error" style="background-color: #ffffcc; color: #ff0000; margin-top: 0.3em; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0.1em; padding-right: 0.1em; padding-bottom: 0.1em; padding-left: 36px; background-position: 10px 50%; border: 2px solid #ff0000;">
<h1 style="font-size: 18px; font-weight: bold; border-bottom-width: 2px; border-bottom-style: solid; text-align: left; margin-top: 0px; margin-right: 0px; margin-bottom: 0.2em; margin-left: 0px; border-color: #ff0000;">错误</h1>
<p><strong>SQL 查询:</strong></p>
<p><span class="syntax" style="font-size: 12px;"><span class="syntax_alpha syntax_alpha_reservedWord" style="color: #990099; font-weight: bold;">CREATE</span>?<span class="syntax_alpha syntax_alpha_reservedWord" style="color: #990099; font-weight: bold;">PROCEDURE</span>?<span class="syntax_quote syntax_quote_backtick" style="color: #008000; white-space: pre;">`ClearCoupon`</span>?<span class="syntax_punct syntax_punct_bracket_open_round" style="color: fuchsia;">(</span>?<span class="syntax_punct syntax_punct_bracket_close_round" style="color: fuchsia;">)</span>?<span class="syntax_alpha syntax_alpha_reservedWord" style="color: #990099; font-weight: bold;">BEGIN</span>?<span class="syntax_alpha syntax_alpha_identifier" style="color: black;">declare</span>?<span class="syntax_alpha syntax_alpha_identifier" style="color: black;">today</span>?<span class="syntax_alpha syntax_alpha_columnType" style="color: #ff9900;">INT</span><span class="syntax_punct syntax_punct_bracket_open_round" style="color: fuchsia;">(</span>?<span class="syntax_digit syntax_digit_integer" style="color: teal;">16</span>?<span class="syntax_punct syntax_punct_bracket_close_round" style="color: fuchsia;">)</span>?<span class="syntax_punct syntax_punct_queryend" style="color: fuchsia;">;</span><br><br></span></p>
<p><strong>MySQL 返回:</strong><img    style="max-width:90%" src="/img/2012/09/19/2133452901.png" alt="文档" title="文档" class="icon" style="vertical-align: middle; border-color: initial; margin-right: 0.3em; margin-left: 0.3em;"  style="max-width:90%"></p>
<code >#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3?</code><br><p><br></p>
<p>解决办法:</p>
<p>存储过程的语法是没错的,出问题的是 语句界定符";"</p>
<p>只需要把phpmyadmin的sql输入框下面的 "语句界定符"改为"//"就OK了</p>
<p><br><img src="/img/2012/09/19/2133452902.png" alt=""></p>
<p>?</p>
<div class="clear">
                 
              
              
        
            </div>
</div></span></p></today>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:小弟不才,求教static的有关问题Nächster Artikel:phpmyadminn装配