首页 > 后端开发 > php教程 > phpMyAdmin平添存储过程

phpMyAdmin平添存储过程

WBOY
发布: 2016-06-13 10:48:53
原创
1001 人浏览过

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="phpMyAdmin平添存储过程" title="phpMyAdmin平添存储过程" 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>
登录后复制
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板