首頁  >  文章  >  資料庫  >  Mysql中存储过程if else的问题简析_MySQL

Mysql中存储过程if else的问题简析_MySQL

WBOY
WBOY原創
2016-06-01 13:42:311414瀏覽

bitsCN.com
以下这样写会报错:
[Error] 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 'end if' at line 8     create procedure test(in a int) if a > 1 then   select 1; elseif a>2 then   select 2; else  end if; [xhtml]create procedure test(in a int)  if a > 1 then    select 1;  elseif a>2 then    select 2;  else       end if;  应改成以下这样: create procedure test(in a int) if a > 1 then   select 1; elseif a>2 then   select 2; else -- do nothing -- set @tmp=1; end if;    作者 zhu473105308 bitsCN.com

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn