I have created a user type in oracle
create or replace type my_array_list
is
table of
varchar2(100);
Now i have written a procedure which has a output parameter like this :
type my_list_rec IS record
(
best_friends my_array_list,
good_friends my_array_list
);
type my_list_array is table of my_list_rec;
procedure friends_diff_prc(my_name in varchar2,
my_friend_list_o out my_list_array ,
rc_o out number);
Now i am calling this proc through my JAVA Class which is extending StoredProcedure.
// Declare output parameter
declareParameter(new SqlOutParameter(
PropertiesReader
.getPropertyValue(FRIENDSConstants.GET_FRIEND_LIST_OUT),
OracleTypes.ARRAY,"MYDB.MY_ARRAY_LIST"));
But when i am calling a proc , i am getting
org.springframework.jdbc.BadSqlGrammarException:
Am i declaring an OUT Parameter correctly??
And how i can parse the contents of that output parameter?
Thanks in advance.
Your example is strikingly confusing. You have purposefully named two types that are very different with very similar name:
my_array_listis aSQLtype: a nested table of VARCHAR2my_list_arrayis aPL/SQLtype: a table of record ofmy_array_listPL/SQL and SQL types are physically very different. For example, PL/SQL types can’t be accessed directly through
jdbc.Furthermore, the two types are logically very different: I can’t see how you can imagine to map the first type to the second. The second type is a collection of objects of the first type, you will never be able to swap the two types, ever.
I suggest the following: