Multiple value parameters with JDBC [message #351721] |
Thu, 02 October 2008 14:27 |
dandormont
Messages: 12 Registered: April 2006
|
Junior Member |
|
|
Can I pass multiple values to a parameter or bind variable? For example if I have a SQL statement like:
select * from users where user_id in (?)
I'd like to pass multiple values for my user_id parameter. Suppose that programmatically, at the time I'm constructing the SQL statement, I don't know how many values I'd like to pass. My application uses the Oracle JDBC THIN driver and needs to run on both 9i and 10g databases. thanks
|
|
|
|
Re: Multiple value parameters with JDBC [message #351865 is a reply to message #351730] |
Fri, 03 October 2008 08:57 |
dandormont
Messages: 12 Registered: April 2006
|
Junior Member |
|
|
Ok so it looks like the proposed solutions are a) create a custom SQL type and a split() function to go along with that, or b) create a temporary table. Those solutions are straightforward enough, but I don't control the target database and my user may not have CREATE FUNCTION, CREATE TYPE or CREATE TABLE privileges. I was hoping I could do something like attach an array to the bind variable itself. Is there a facility for that?
|
|
|
|
Re: Multiple value parameters with JDBC [message #351883 is a reply to message #351881] |
Fri, 03 October 2008 10:34 |
dandormont
Messages: 12 Registered: April 2006
|
Junior Member |
|
|
Your point is well taken, but at the same time I don't think it's so unreasonable to think that one might have a database that allows a certain application to talk to it with limited privileges, namely to run SELECT statements on certain tables/views and execute certain functions...
|
|
|
Re: Multiple value parameters with JDBC [message #351890 is a reply to message #351883] |
Fri, 03 October 2008 11:22 |
|
Michel Cadot
Messages: 68732 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote: | might have a database that allows a certain application to talk to it with limited privileges,
|
To talk yes, but to develop them, it is doubtful above when it is about creating objects.
Same thing that you can't create new classes in Java.
You don't create them on the fly. You create them for your application to work with.
Regards
Michel
|
|
|