我在oracle中创建了一个用户类型
create or replace type my_friend_list
is
table of
varchar2(100);
现在我写了一个程序,它有一个像这样的输出参数:
PROCEDURE friends_diff_prc
(
my_name IN VARCHAR2,
friend_i IN my_friend_list ,
good_friend_o OUT my_friend_list ,
best_friend_o OUT my_friend_list ,
isSuccess OUT NUMBER
);
我在 SQLDeveloper
上运行它,它运行正常。
它给我列出了我的好 friend 和最好的 friend 。
但是当我通过扩展 StoredProcedure
的 JAVA 类调用它时。
best_friend
列表正确,但对于 good_friend
列表它正在打印
Ljava.lang.Object;@24342434,
Ljava.lang.Object;@243a243a,
Ljava.lang.Object;@24402440,
Ljava.lang.Object;@24462446
我获取这个输出数组列表的 java 代码是这样的:
List<String> goodfriends = Arrays.asList((String[]) results.get("good_friend_o");
List<String> bestfriends = Arrays.asList((String[]) results.get("best_friend_o");
为什么它没有为 good_friends 给出正确的结果?
提前致谢。
最佳答案
您将答案作为字符串数组获取,然后存储在列表字符串中。您不能将字符串[] 直接存储到字符串中。
你能发布用于获取和打印的 java 代码吗...
关于java - 为什么字符串打印不正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12529600/