mysql存储过程乱炖
来源:互联网 发布:安信股票交易软件 编辑:程序博客网 时间:2024/05/17 01:26
package test.procedure;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Types;
import javax.naming.spi.DirStateFactory.Result;
public class TestProcedure {
public static void main(String args[]) throws ClassNotFoundException, SQLException{
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?noAccessToProcedureBodies=true","root","123456");
CallableStatement callableStatement = connection.prepareCall("{call p(?,?,?)}");
callableStatement.registerOutParameter(3, Types.INTEGER);
callableStatement.setInt(1, 2);
callableStatement.setInt(2, 2);
int result = 0;
callableStatement.setInt(3, result);
callableStatement.execute();
System.out.println(callableStatement.getInt(3));
callableStatement.close();
connection.close();
}
}
delimiter //
create procedure p(in v_a int, v_b int, out v_ret int)
begin
if v_a > v_b then
set v_ret = v_a;
else
set v_ret = v_b;
end if;
select v_ret;
end
//
http://database.51cto.com/art/201011/235017.htm
http://blog.csdn.net/langzi7758521/article/details/52911796
http://stackoverflow.com/questions/6434573/mysql-execute-command-denied-to-user-localhost-for-routine-error
http://www.cnblogs.com/AloneSword/p/3591702.html
- mysql存储过程乱炖
- 【mysql】mysql存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- MySQL存储过程详解 mysql 存储过程
- PHP 性能分析与实验——性能的宏观分析
- Python实现K-Means聚类算法
- 常量的五层复用层次
- MyBatis Generator 自动生成Dao、Bean、Mapping相关
- 反键索引/反向索引
- mysql存储过程乱炖
- 计算结构体的大小(对齐)
- 动态权限及利用ContentResolver读取系统的可共享数据
- 完美的解释了BP神经网络,自己要通过算法计算一下
- Unity3D教程:教你如何利用Shader来进行3D角色的渲染 |
- Android仿酷狗音乐自定义侧滑菜单控件简单实现
- 启动tomcat的时候一直卡在INFO: Deploying web application
- javaweb开发之servlet
- 【Darwin学习笔记】之QTSSReflectorModule的Describe消息处理