Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Function that takes an array of objects and is called from Java, how to please?

user549560Nov 2 2017 — edited Nov 24 2017

Hi! Perhaps I am not using the right terms when I search but I am unable to find any posts on how to create a function that takes as a parameter a variable sized array of objects.

For example, I'd like to pass 10 objects into my function. Each object contains 3 fields (col1, col2, col3) with values

col1    col2   col3

--------------------------------

1          2          3

1          4          7

2          1          1

2          22        99

etc

I'd like to loop over this variable length "array" and insert these values into a table.

something like this:

INSERT INTO myTable (COL1,COL2,COL3) VALUES(Obj[i],Col1, Obj[i].Col2, Obj3[i].Col3);

I have no problem passing an array of let's say integers and loop over. But how do I pass an array of objects? Perhaps there is some sort of a jagged or multidimensional array available?

Then I need to call it from Java. So the solution must be accessible via jdbc.

Any ideas/linkies/samples are greatly appreciated.

Infinite thanks in advance,

This post has been answered by BrendanP on Nov 6 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2017
Added on Nov 2 2017
22 comments
1,704 views