存储过程
Dao dao = new NutDao(sds);
dao.run(new ConnCallback() {
@Override
public void invoke(Connection conn) throws Exception {
CallableStatement cstm=conn.prepareCall("call detail(?)");
cstm.registerOutParameter(1, OracleTypes.CURSOR);
cstm.execute();
ResultSet rs = (ResultSet)cstm.getObject(1);
final ResultSetMetaData rmd=rs.getMetaData();
ResultSetLooping ing = new ResultSetLooping() {
protected boolean createObject(int index,
ResultSet rs,
SqlContext context,
int rowCout) {
NutMap re = new NutMap();
Record.create(re, rs, rmd);
list.add(re);
return true;
}
};
ing.doLoop(rs, new SqlContext());
List<NutMap> re=Lang.collection2list(ing.getList(), NutMap.class);
System.out.println(re);
}
});
CREATE OR REPLACE PROCEDURE detail(c OUT sys_refcursor)
is
begin
open c For select * from x_table;
end detail;