here\'s the stored procedure i wrote.In this proc \"p_subjectid\" is an array of numbers passed from the front end.
PROCEDURE getsubjects(p_subjectid subject
I just had this problem yesterday.
DECLARE TYPE number_table IS TABLE OF NUMBER; result_ids number_table := number_table(); BEGIN /* .. bunch of code that uses my type successfully */ OPEN ? AS SELECT * FROM TABLE(CAST(result_ids AS number_table)); /* BOOM! */ END;
This fails in both of the ways you described earlier when called from a java routine. I discovered this was due to the fact that the type number_table is not defined in an exportable manner than can be shipped off the database. The type works great internally to the routine. But as soon as you try to execute a returnable recordset that references it in any way (including IN clauses?!?) you get a datatype not defined.
So the solution really is CREATE TYPE myschema.number_table IS TABLE OF NUMBER; Then drop the type declaration from your block and use the schema level declaration. Use the schema qualifier to reference the type just to be sure you are using the right one.