MySQL 存储过程示例
两种方法获取返回值 1.用select BEGIN SELECT * from nodelist t where t.id = id; END; 2.用out模式或者inout模式 BEGIN END; 声明变量 datatype 为 MySQL 的数据类型 declare cid int unsigned default 40000; declare ccs VARCHAR(255) default ""; 赋值 set @tid = inParam; set cid = cid +@tid; if-else case-when-then while IF @tid = 1 then set @tid = 2; else set cid = 20; end if; case @tid when 0 THEN set @tid=100; when 1 then set @tid=200; else set @tid=300; end case; while @tid>0 do set cid=cid+1; set @tid = @tid-1; end while; mybatis调用MySQL函数和过程 <!-- mybatis xml --> <select id="shopOrderQty" resultType="java.lang.Integer"