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);            
     }
}

Need Your Help

PDF to SWF convert by cmd in php

flash swfloader pdf2swf

hi i use this code to convert pdf to the swf i have pdf2swf.exe file in my site in the local server and i want to move pdf called 1.pdf to that pdf2swf.exe to be convert using command line buts it ...

Blogger issue with custom background images on Chrome and Safari

css safari google-chrome blogger

This is weird, the site in question is blog.andrebatista.info and it is a hosted at blogger.com. I'm trying to make the blogger template look the same as the one in my main website,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.