wood burning stoves 2.0*
The moose likes Oracle/OAS and the fly likes How to pass an Integer Array to a Stored Procedure in mysql? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "How to pass an Integer Array to a Stored Procedure in mysql?" Watch "How to pass an Integer Array to a Stored Procedure in mysql?" New topic
Author

How to pass an Integer Array to a Stored Procedure in mysql?

Shifali Rana
Greenhorn

Joined: Jul 08, 2010
Posts: 11
Hi

I want to pass the Stored Procedure "1,2,3" as a Integer Array, is this possible in mysql?

Actually I have to do
select * FROM User WHERE id IN (1,2,3);
I want to pass the Stored Procedure "1,2,3" as a Integer Array

If i use varchar then sometimes the query executes fine But, sometimes it gives no records.


Thanks


Agador Paloi
Ranch Hand

Joined: Jan 24, 2006
Posts: 118
You could parse the string of numbers , such as '10,20,30' into an array of integers with a function you write using
substr and instr functions. I am not sure if that is what you are talking about.


Agad
Shifali Rana
Greenhorn

Joined: Jul 08, 2010
Posts: 11
Hi

Thanks Agad

Can you please give some example of a procedure that passes an integer array.
What i know is that we have to create a temporay table which contains the value that we have to pass to where clause.


Is it the only way to create an integer array in mysql?

Shifali
Agador Paloi
Ranch Hand

Joined: Jan 24, 2006
Posts: 118
You will need to create a type that is a table of integers ( an array of integers type)


Then use it as a type for your function or procedure


should work
 
GeeCON Prague 2014
 
subject: How to pass an Integer Array to a Stored Procedure in mysql?