mysql存储过程且mybatis调用
2017-07-05 19:18
441 查看
首先,需要执行符DELIMITER ,建议用//,即在存储过程开始前定义delimiter //,在结束后加上//,最后加上DELIMITER ; 具体原因@参考文章1写的很清楚,不再赘述。
参考文章1中的示例:
View Code
参考文章1中的示例:
mysql> drop procedure test; Query OK, 0 rows affected mysql> delimiter // mysql> create procedure test(in i int) begin declare t int; -> while i<4 do -> set i=i+1;end while; set t=i;select * from user where id=t;end // Query OK, 0 rows affected mysql> delimiter ; mysql> select * from user; +----+-------+ | id | name | +----+-------+ | 1 | yanan | | 2 | zhang | | 3 | 1234 | | 4 | 7890 | +----+-------+ 4 rows in set mysql> call test(-1); +----+------+ | id | name | +----+------+ | 4 | 7890 | +----+------+ 1 row in set Query OK, 0 rows affected mysql> call test(4); +----+------+ | id | name | +----+------+ | 4 | 7890 | +----+------+ 1 row in set Query OK, 0 rows affected mysql> call test(5); Empty set Query OK, 0 rows affected mysql>
View Code
相关文章推荐
- mybatis调用MySQL存储过程
- MySQL 存储过程实例 与 ibatis/mybatis/hibernate/jdbc 如何调用存储过程
- Mybatis调用MySQL存储过程
- Mybatis调用mysql存储过程
- Mybatis调用MySQL存储过程
- mybatis调用mysql存储过程返回结果集
- mysql 存储过程调用 mybatis/hibernate
- MySQL存储过程中的错误处理 以及mybatis调用存储过程的例子
- mybatis调用mysql存储过程的例子
- Mybatis调用Mysql存储过程
- Mybatis调用MySQL存储过程的简单实现
- 在mybatis调用mysql的存储过程
- mybatis mysql 关于调用存储过程获取查询结果
- mybatis调用mysql存储过程的例子
- Mysql的存储过程,Mybatis对存储过程的调用
- mybatis调用mysql存储过程的例子
- mybatis结合mysql,调用含有入参和出参的存储过程的方式
- mysql 存储过程调用 mybatis/hibernate
- mysql存储过程学习及java调用存储过程
- MySQL存储过程例子,包含事务,输出参数,嵌套调用,游标,循环等等