Calling a Stored Procedure in a Database
来源:互联网 发布:js 内置对象 编辑:程序博客网 时间:2024/05/02 00:41
This example demonstrates how to call stored procedures with IN, OUT,and IN/OUT parameters.
CallableStatement cs;
try {
// Call a procedure with no parameters
cs = connection.prepareCall("{call myproc}");
cs.execute();
// Call a procedure with one IN parameter
cs = connection.prepareCall("{call myprocin(?)}");
// Set the value for the IN parameter
cs.setString(1, "a string");
// Execute the stored procedure
cs.execute();
// Call a procedure with one OUT parameter
cs = connection.prepareCall("{call myprocout(?)}");
// Register the type of the OUT parameter
cs.registerOutParameter(1, Types.VARCHAR);
// Execute the stored procedure and retrieve the OUT value
cs.execute();
String outParam = cs.getString(1); // OUT parameter
// Call a procedure with one IN/OUT parameter
cs = connection.prepareCall("{call myprocinout(?)}");
// Register the type of the IN/OUT parameter
cs.registerOutParameter(1, Types.VARCHAR);
// Set the value for the IN/OUT parameter
cs.setString(1, "a string");
// Execute the stored procedure and retrieve the IN/OUT value
cs.execute();
outParam = cs.getString(1); // OUT parameter
} catch (SQLException e) {
}
- Calling a Stored Procedure in a Database
- Calling a Stored Procedure in a Database
- Creating a Stored Procedure or Function in an Oracle Database
- Calling a PL/SQL procedure in ODI
- Calling a Function in a Database
- navicate how to create a stored procedure
- navicate how to create a stored procedure
- How To Use a DataReader Against an Oracle Stored Procedure in Visual C# .NET
- Sql Server - How to write a Stored procedure in Sql server
- Passing an array or DataTable into a stored procedure
- illustrates how to call a SQL Server stored procedure
- [转贴]How do I find a stored procedure containing ?
- Twenty tips to write a good stored procedure
- Debug stored procedure in VS2005
- Use Stored Procedure in JPA
- Sql server database stored procedure reference 01
- ORA-06550 & PLS-00306 passing a parameter array to a stored procedure
- About relationships in a database
- JS中的escape方法
- GNU/Linux 编程指南之三: autoconf-----configure software to a target platform
- 用一个例子讲解Adapter设计模式
- edit distance
- 乔布斯2005年在斯坦福大学的演讲
- Calling a Stored Procedure in a Database
- VC++,掀起你的盖头来
- 在Visual Studio 下编译 sqlite3
- Windows Media Player及RealOne网页播放器参数含义(一)
- Windows Media Player及RealOne网页播放器参数含义(二)
- MS SQL(SQL Server)技巧
- JAVA堆与栈的分析
- 老头子,我要走了,抱抱我吧。
- 武汉公交521