• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem while setting multiple Oracle Arrays as input to a proc

 
Vijay Bhore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using oracle.sql.ARRAY in call to a database procedure.
I am providing the code snippet below.

First I have created an object of ArrayDescriptor 'desc'.

ArrayDescriptor desc = ArrayDescriptor.createDescriptor("HOST_ARRAY", conn);

Further I am using the same descriptor to create three Oracle arrays..

ARRAY inArrayCustIps = new ARRAY(desc, conn, changeSipsRequest.getCustIps());
ARRAY inArrayTotalHostIps = new ARRAY(desc, conn, changeSipsRequest.getTotalHostIps());
ARRAY inArraySelectedHostIps = new ARRAY(desc, conn, changeSipsRequest.getHostIps());

Further i have set the Arrays as input to proc according to correct index as

ocs.setARRAY(8, inArrayCustIps);
ocs.setARRAY(9, inArrayTotalHostIps);
ocs.setARRAY(10, inArraySelectedHostIps);

But the problem i am facing is that values are not being passed to proc.
Can anybody suggest, what is the problem and how can i resolve it.

Thanks in advance.

Regards,
Vijay
 
Vijay Bhore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will follow the same thread,

It's working after i made two changes

1) Created three different descriptors for three different oracle arrays as

ArrayDescriptor descOne = ArrayDescriptor.createDescriptor("HOST_ARRAY", conn);
ArrayDescriptor descTwo = ArrayDescriptor.createDescriptor("SUBNET_ARRAY", conn);
ArrayDescriptor descThree = ArrayDescriptor.createDescriptor("NEW_HOST_ARRAY", conn);

2) I had initialized String arrays of size 20 whereas arrays can contain only 1-10 values.
Now i have initialized arrays dynamically according to number of actual number of elements in array.
Hence the chances of the oracle array containing null values got minimized.

Regards,

Vijay Bhore
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!