oracle - How to use SQL 'IN' (or 'ANY') operator with VARRAY in PL/SQL -



oracle - How to use SQL 'IN' (or 'ANY') operator with VARRAY in PL/SQL -

my .net code using odp.net phone call stored procedure many times operate on various rows in many tables. .net code has array of rows change. 1 parameter changes in each call, , i'd pass array .net pl/sql operate on multiple rows (the number of rows change).

i've passed array .net pl/sql using:

type number_arr table of number(10) index pls_integer; procedure "blah" (foo in number_arr);

note believe number_arr called varray, i'm not positive that, , if wants right me, please (as comment), might contributing confusion.

but now, in pl/sql, have many update statements used like:

update t set = b = foo;

when foo wasn't array. want write:

update t set = b in (foo);

but syntax doesn't seem work. , i've been unable find illustration oracle combines utilize of varray , 'in' (or 'any', etc.). , i've seen answers how sql server, i'm not sure how translate oracle.

of course, if there other way array .net stored procedure this, reply question. i'm looking gain efficiency in, itterates on array in pl/sql (to phone call update statements separately) won't help.

the array you're using associative array, not varray. varrays , nested tables can used in sql, associative arrays cannot. however, since you're trying in pl/sql in first place, can utilize mass bind (which work associative array):

procedure blah (foo in number_arr) number; begin forall in foo.first .. foo.last update t set = b = foo(i); end blah;

if created number_arr varray in database instead of associative array, utilize table function instead:

create type number_arr varray(10) of number; create procedure blah (foo in number_arr) begin update t set = b in (select * table(foo)); end blah;

note that, in case, type has defined in database, not in package. also, method won't faster using forall.

sql oracle plsql odp.net varray

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -