Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing an array of objects to stored proc(Oracle)

 
priyam rao12
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have to pass an array of objects to a pl/sql stored proc.
Its prototype is,
proc_orderins(ordernum varchar2(14), ct newTask)

where newTask is an array of objects:
type task as object ( name varchar2(20),odd varchar2(8),sdd varchar2(8));

create or replace type newTask as VARRAY(25) OF Task;

will the following work from the java code :
public class CriticalTask
{
String name,odd,sdd;
public CrticalTask(String name,String odd,String sdd)
{
this.name=name;
this.odd=odd;
this.sdd=sdd;
}
}
Object [] ctasks =new Object[7];
for(i=0;i<7;i++)
Object=new CrtitcalTask("x","x","x");

String query="{call proc_orderins(?,?)}";
CallableStatement cstmt=con.prepareCall(query);
cstmt.setInt(123);
cstmt.setObject(ctasks);
cstmt.execute();

will the above code work, when I am passing an array?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"priyam rao12",
Please check your private messages.

Thank you,
Jeanne
JavaRanch Sheriff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic