DB2 Application Development with Java
1. JDBC Application Development
1.1 Calling Stored Procedures with CallableStatement
A CallableStatement object can be used to call stored procedures. For example, to call the high_paid_employees stored procedure, the following code can be used:
CallableStatement cstmt;
// (1) Create the CallableStatement object to invoke the stored procedure
cstmt = con.prepareCall("call high_paid_employees(?)");
// (2) Set the input parameter
cstmt.setInt(1, 80000);
// (3) Execute the query and get the result set
ResultSet rs = cstmt.executeQuery();
System.out.println("High - paid employees list\n" +
"------------------------");
// (4) Loop
超级会员免费看
订阅专栏 解锁全文
917

被折叠的 条评论
为什么被折叠?



