1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Statement stmt1 = oc.createStatement();
String sql = "SELECT 1 FROM dual UNION SELECT 2 FROM dual";
ResultSet rSet1 = stmt1.executeQuery(sql);
while ( rSet1.next() )
{
System.out.println(rSet1.getString(1));
cstmt2 = oc.prepareCall
("begin ? := my_package.my_cursor(?); end;");
cstmt2.registerOutParameter(1, OracleTypes.CURSOR);
cstmt2.setString(2, rSet1.getString(1));
cstmt2.execute();
cursor2 = ((OracleCallableStatement)cstmt2).getCursor(1);
while (cursor2.next ())
{System.out.println (cursor2.getString(1));}
cstmt2.close();
cursor2.close();
}
rSet1.close();
stmt1.close(); |
Partager