Thursday, 15 July 2010

sql - Pass a list of integers from C# into Oracle stored procedure -



sql - Pass a list of integers from C# into Oracle stored procedure -

i have oracle stored procedure updates table next statement.

update boxes set location = 'some value' boxid = passed value

i have page user selects 100+ boxes , updates them new location value. currently, have phone call stored procedure 100+ times update each box(by passing boxid each time).

i want know how can pass list of boxids c# stored procedure have phone call stored procedure 1 time.

i hoping utilize where in(boxids) kind of clause in update statement.

please allow know how can accomplish this. in advance!

oracle allows pass arrays of values parameters. borrowing this question , this one can define int_array type this:

create or replace type char_array table of integer;

then define stored procedure as:

create or replace procedure product_search( ... myids in char_array, ...) select ... ... someidfield in (select column_value table(myids)) ...

you can pass list of values setting oracleparameter.collectiontype property this:

oracleparameter param = new oracleparameter(); param.oracledbtype = oracledbtype.int32; param.collectiontype = oraclecollectiontype.plsqlassociativearray;

c# sql oracle stored-procedures

No comments:

Post a Comment