Forums Register Login

CallableStatement * setObject

+Pie Number of slices to send: Send
Hello all...hopefully someone out here can square me away.

I recall being able to pass an array of Strings to a stored procedure via CallableStatement's setObject method (inherited) at one point in my career (just over a year ago). At the time, the shop I was working for used SQLServer on the backend and a driver from inet. Now I'm at an Oracle shop and it seems like I can't get away with the same syntax (using a 9i driver)...

Ideally, I'd like to be able to write something along the lines of...

--------------------
CallableStatement cst = conn.prepareCall("{call mypackage.proc(?)}");
cst.setObject(1, new String[] {"foo", "bar"});
cst.execute();
--------------------

The first requirement is that I be able to use setObject to pass an array into PL/SQL. I can do this with Oracle-specific code but the purist in me won't have it.

The second requirement is that the size of that array be flexible. I'm up for bending on proprietary-ness here.

When I try to pull this off today, I'm told that I'm passing in the wrong *type* - I believe PL/SQL is expecting a VARRAY. That could be right, it could be wrong...I'm looking for any sort of feedback as to how to pull this off with Oracle on the backend.

Thanks guys/girls.
+Pie Number of slices to send: Send
I have been through this same issue. Unfortunitely the solution I had to use contained the Oracle specific code using setArray with the Oracle Driver. Good luck in finding another way. I would be interested as well in knowing how to do it from a data base independent manner.
Did you miss me? Did you miss this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3684 times.
Similar Threads
Passing java arrays to PL/SQL and vice versa
App/Business Logic in Stored Procedures?
PL/SQL stored procedures
Passing Array as a parameter to Stored procedures
wrong number or types of arguments in call to 'P_RETRIEVE_OPPTY_ORDER_STATUS'
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:05:30.