如何将in参数传递给存储过程? [英] How to pass a in parameter to a stored procedure?

查看:122
本文介绍了如何将in参数传递给存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java代码,我想调用一个存储过程(sql server2012)。我不知道如何将参数传递给该存储过程,因为java代码接受命令行参数。所以请建议我如何通过命令行参数传递输入

i have a java code,in which i want to call a stored procedure(sql server2012).I don''t know how to pass the parameter to that stored procedure because the java code accepts command line arguments.So please suggest me how to pass the input through command line arguments

推荐答案

这是一个例子: JDBC CallableStatement - 存储过程IN参数示例 [ ^ ]

示例:

Here is an example: JDBC CallableStatement – Stored Procedure IN parameter example[^]
Example:
//insertDBUSER is stored procedure
String insertStoreProc = "{call insertDBUSER(?,?,?,?)}";
callableStatement = dbConnection.prepareCall(insertStoreProc);
callableStatement.setInt(1, 1000);
callableStatement.setString(2, "mkyong");
callableStatement.setString(3, "system");
callableStatement.setDate(4, getCurrentDate());
callableStatement.executeUpdate();


这篇关于如何将in参数传递给存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆