<p>How can I create an Oracle stored procedure which accepts a variable number of parameter values used to feed a IN clause?</p>

<p>This is what I am trying to achieve. I do not know how to declare  in PLSQL for passing a variable list of primary keys of the rows I want to update.</p>

<pre><code>FUNCTION EXECUTE_UPDATE
  ( &lt;parameter_list&gt;
   value IN int)
  RETURN  int IS
BEGIN 
    [...other statements...]
    update table1 set col1 = col1 - value where id in (&lt;parameter_list&gt;) 

    RETURN SQL%ROWCOUNT ;
END;
</code></pre>

<p>Also, I would like to call this procedure from C#, so it must be compatible with .NET capabilities. </p>

<p>Thanks,
Robert</p>

I've not done it for Oracle, but with SQL Server you can use a function to convert a CSV string into a table, which can then be used in an IN clause. It should be straight-forward to re-write this for Oracle (I think!)
```
```
CREATE Function dbo.CsvToInt ( @Array varchar(1000)) 
returns @IntTable table 
    (IntValue nvarchar(100))
AS
begin

    declare @separator char(1)
    set @separator = ','

    declare @separator_position int 
    declare @array_value varchar(1000) 

    set @array = @array + ','

    while patindex('%,%' , @array) <> 0 
    begin

      select @separator_position =  patindex('%,%' , @array)
      select @array_value = left(@array, @separator_position - 1)

        Insert @IntTable
        Values (Cast(@array_value as nvarchar))

      select @array = stuff(@array, 1, @separator_position, '')
    end

    return
end
```
```
Then you can pass in a CSV string (e.g. '0001,0002,0003') and do something like
```
```
UPDATE table1 SET 
       col1 = col1 - value 
WHERE id in (SELECT * FROM csvToInt(@myParam))
```
```