pl/sql中是否有proc*c中数组插入和删除的功能?如何写?
如a(1) := 1, a(2) := 2, a(3) := 3;
Insert Into tab(id) Values(a);
Delete From tab Where id = a;
如何实现上面的功能?
如a(1) := 1, a(2) := 2, a(3) := 3;
Insert Into tab(id) Values(a);
Delete From tab Where id = a;
如何实现上面的功能?
比如
TYPE A_TYPE IS RECORD
(
id char --还有类型比如这里是char
);
a_type A_TYPE;
TYPE A_TYPE_ARRAY IS TABLE OF A_TYPE INDEX BY BINARY_INTEGER;
a_type_array A_TYPE_ARRAY; -----这里是定义数组然后赋值的时候这样: a_type.id := 1;
a_type_array(1) := a.type; --这样就存放在数组里面了最后insert的时候Insert Into tab(id) Values(a_type_array(1).id); 循环的话,适当的变下就可以了
declare
type abc is table of number index by binary_integer;
x abc:=abc(4,5,6);
begin
forall i in 1 .. 3
insert into t1 values(x(i),x(i));
forall i in 1 .. 3
delete from t1 where id=x(i);
end;
type type_array_number is table of varchar2(20) index by binary_integer;
v_array_number type_array_number;
v_bulk_limit number := 2000;
open cursor_xxx;
loop
fetch cursor_xxx bulk collect into v_array_number limit v_bulk_limit;
exit when v_array_number.count = 0;
forall row in 1 .. v_array_number.count()
Delete From tab Where number = v_array_number(row);
exit when cursor_xxx%notfound;
commit;
end loop;
close cursor_xxx;
//插入,更新操作和上面的类似!