关于调用function返回ARRAY的问题

lovedudd 2003-08-21 09:06:37
为什么调用function返回ARRAY,取出来的数据都是16进制数,有什么问题吗
...全文
77 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
beckhambobo 2003-08-21
  • 打赏
  • 举报
回复
发生什么问题,举个例子
lovedudd 2003-08-21
  • 打赏
  • 举报
回复
CREATE OR REPLACE type emparray IS varray(1000) of varchar2(100)
/
CREATE OR REPLACE FUNCTION getEmpArray
RETURN EMPARRAY AS
l_data EmpArray := EmpArray();
begin
l_data.extend;
l_data(l_data.count) := '111';
RETURN l_data;
END;
/


用java调用的时候

public static void main( ) {..................
OracleCallableStatement stmt =(OracleCallableStatement)conn.prepareCall ( "begin ?:= getEMpArray; end;" );
// The name we use below, EMPARRAY, has to match the name of the
// type defined in the PL/SQL Stored Function
stmt.registerOutParameter( 1, OracleTypes.ARRAY,"EMPARRAY" ); stmt.executeUpdate();
// Get the ARRAY object and print the meta data assosiated with it
ARRAY simpleArray = stmt.getARRAY(1);
System.out.println("Array is of type " + simpleArray.getSQLTypeName()); System.out.println("Array element is of type code "+simpleArray.getBaseType());
System.out.println("Array is of length " + simpleArray.length());
// Print the contents of the array
String[] values = (String[])simpleArray.getArray();
for( int i = 0; i < values.length; i++ )
System.out.println( "row " + i + " = '" + values[i] +"'" );

values[i] 打印出来的就是16进制数了,不知道为什么,
望高人能解决!!!!!!!
谢谢

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧