带有输入参数的存储过程
来源:互联网 发布:大张伟 天天向上 知乎 编辑:程序博客网 时间:2024/05/17 01:37
创建带有输入参数的存储过程:
drop procedure if exists proc_user_in;delimiter //create procedure proc_user_in(in in_param int)beginselect * from user where userid > in_param;end//delimiter ;以上代码即在当前数据库中创建了存储过程,名字为proc_user_in,可调用此存储过程查询userid大于一定值的记录。
在命令栏里调用此存储过程代码:
call proc_user_in(2);在类中写如下关键代码调用此存储过程:
public static void main(String[] args) {Connection con = null;CallableStatement cs = null;try {con = getConnection();String sql = "{call proc_employee_in(?)}";cs = con.prepareCall(sql);cs.setInt(1, 2);ResultSet rs = cs.executeQuery();while (rs.next()) {System.out.print(rs.getInt(1) + "..." + rs.getString(2));}} catch (Exception e) {e.printStackTrace();}}
以上两种方式调用该存储过程,均可打印出userid>2的全部记录。
0 0
- 带有输入参数的存储过程
- oracle使用带有输入和输出参数的存储过程
- oracle使用带有输入和输出参数的存储过程
- 带有参数的存储过程
- 带有输出参数的存储过程
- 执行带有输出参数的存储过程
- ADO调用带有参数的存储过程
- 带有输出参数的存储过程
- 带有输入输出参数的存储过程
- 使用带有输出参数的存储过程
- mysql 带有无参数的存储过程
- 企业库5.0——执行带有输入、输出参数的存储过程
- Oracle pl/sql编程 20---在java中调用带有输入参数的存储过程
- Oracle 存储过程 调用带有 out 参数的存储过程
- oracle :带有out参数的存储过程的调用方法
- oracle在job中调用带有参数的存储过程
- asp.net 调用带有输出参数的存储过程
- 用exec调用带有output输出参数的存储过程
- 深圳西乡兼职女
- http头中的host字段详解
- Scrapy 安装问题集锦
- 【HDU】5367 digger【动态线段树】
- ORACLE中让某一列输出的结果的货币单位为$或者¥
- 带有输入参数的存储过程
- Trapping Rain Water
- 【Java多线程】之一:Thread Simple Example
- 【003.Matlab基础 数组】
- 第80讲:List的泛型分析以及::类和Nil对象学习笔记
- 左移 & 右移
- android的Http协议学习与应用——连接一个网页
- 自己封装的XMLHttpRequest2 ajax
- 14、 C语言和设计模式(状态模式)