我需要执行这个 SQL 代码:
exec ais_disp.p_lk.p_add_client
(v_sis_id => 1640,
v_proc_id => 1,
v_time_start => to_date('01032013 00:00','ddmmyyyy hh24:mi'),
v_time_end => to_date('31032013 23:59','ddmmyyyy hh24:mi'));
select * from ais_disp.v_lk_1;
commit;
并从此查询中获取 ResultList。
我试着这样做:
CallableStatement stmt = connection.prepareCall("{call ais_disp.p_lk.p_add_client " +
"(1640,
1,
to_date('01032013 00:00','ddmmyyyy hh24:mi'),
to_date('31032013 23:59','ddmmyyyy hh24:mi'))}");
stmt.execute();
ResultSet rs2 = stmt.executeQuery("select * from ais_disp.v_lk_1");
System.out.println(rs2);
while (rs2.next()){
System.out.println(rs2.getString("LRP_STATUS_NAME"));
}
stmt.close();
但它返回 empty ResultSet
。我做错了什么?数据库是Oracle数据库。
更新:
我之前已将此字符串添加到代码中stmt.executeQuery("select * from ais_disp.v_lk_1")
:
stmt.execute();
但它仍然不返回任何行。也许我需要以某种方式在可调用语句中添加选择语句。那么该怎么做呢?