Subject SP parameter passing implementation
Author Sudheer Palaparambil
Hi Friends,

How do I design a Stored Procedure whose number of parmeters
can only be determined at run time ?

The situation is like this, I have an order detail table with
the following structure at the Head Office(Data is transferred
to branches on a daily basis)

branch_id
order_id
product_id
quantity
....
....

There are around 40 branches and more branches will be added.

If the user selects 5 branches, I need to return only the
details of those 5 branches. So the number of parameters
(branch_id) may vary depending on the selection of the user.

What I am thinking is use a table for this purpose and update
it with the selected branch_id from my client application and
make the branch_id available in the SP. I cannot do without SP
also. Is this a prefered way? Is there any other way to implement
this?

Any reply is greatly appreciated.

Thank you.

Sudheer Palaparambil