Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing array to CallableStatement

 
Nidhi Singhal
Ranch Hand
Posts: 89
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i am using CallableStatement to call an Oracle stored procedure.
i want to pass an array to the procedure (as 'In' parameter).

in java, i have declared my array as follows..
String arr_ctr[] = new String[10];

Please tell me how to pass this array to the Oracle stored procedue using Callable Statement from java servlet.

Please help me out...

Thanks....

Nidhi
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is signature of your stored procedure
 
rahul V kumar
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your database?

You could do something like this.

1) Create a Type on your database. On oracle it would be something like this
type VARCHAR2_TABTYPE as table of varchar2(1000);
2)


hope this helps.
 
Udayan Patel
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by rahul V kumar:
What is your database?

You could do something like this.

1) Create a Type on your database. On oracle it would be something like this
type VARCHAR2_TABTYPE as table of varchar2(1000);
2)


hope this helps.


If you want to do it go for it but it is not a good idea, to bind your application to a specific database and driver.
 
rahul V kumar
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not suggesting to bind to a database nor a driver.

What I tried to point out is that , this is the way it could be done on oracle. I hope on SQL Server too you have some mechanism to create a "TYPE" object.

And you need this "TYPE" object because ArrayDescriptor needs one.

Hope this helps
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a Servlet question, moving it to JDBC.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Nidhi S",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic