|
在oracle中定义了一个列表的类型nsrlist:
create or replace type nsrlist is varray(2000) of varchar2(20)
存储过程body如下:
create or replace package body TESTVARRAY is
procedure testSS( nsrs out nsrlist ) is
nsrarray nsrlist := nsrlist('a1','a2','a3');
begin
nsrs := nsrarray;
end;
begin
null;
end TESTVARRAY;
在java代码中是这样调用的:
Connection conn = session.connection();
CallableStatement proc = null;
try
{
proc = conn.prepareCall({ call TESTVARRAY.testSS(?) });
proc.registerOutParameter(1, OracleTypes.ARRAY, "NSRLIST");
proc.execute();
ResultSet rs = null;
Array simpleArray = proc.getArray(1);
rs = simpleArray.getResultSet();
while(rs.next())
{
System.out.println(rs.getString(2));
}
}catch(SQLException e)
{
e.printStackTrace();
}
控制台输出的结果变成了
0x6131
0x6132
0x6133
这是怎么回事呢? |
|