Why string is not printing correctly?
I have created a user type in oracle
create or replace type my_friend_list is table of varchar2(100);
Now i have written a procedure which has a output parameter like this :
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 );
I run it on SQLDeveloper And it is running correctly .
And it is giving me list both of my good friends and best friends.
But when i am calling it through JAVA Class which is extending StoredProcedure.
best_friend list is correcly coming but for the good_friend list it is printing
Ljava.lang.Object;@24342434, Ljava.lang.Object;@243a243a, Ljava.lang.Object;@24402440, Ljava.lang.Object;@24462446
My java code to fetch this output arraylist is like this:
List<String> goodfriends = Arrays.asList((String[]) results.get("good_friend_o"); List<String> bestfriends = Arrays.asList((String[]) results.get("best_friend_o");
Why it is not giving correct result for good_friends ?
Thanks in advance.
Answers
Your Getting the answer as Array of String, and then storing in a String of List.. You cannot store the String[] into String straightly.
can you post the, java code for fetching and printing...
Try this code. This will print the strings
System.out.println("Printing goodfriends"); for (Object object : goodfriends) { Object[] goodfriendsString = (Object[]) object; for (Object object2 : objLocationVO) { System.out.println(object2); } }