批量绑定
来源:互联网 发布:好玩的java游戏代码 编辑:程序博客网 时间:2024/05/06 06:52
/—————–批量绑定——————————————/
create table en (
id number primary key,
name varchar2(100)
);
declare
type id_table_type is table of number
index by binary_integer;
type name_table_type is table of varchar2(100)
index by binary_integer;
v_id id_table_type;
v_name name_table_type ;
start_time number(10);
end_time number(10);
begin
for i in 5001..10000 loop
v_id (i) := i;
v_name (i) :=’name’|| i ;
end loop;
start_time := to_number(dbms_utility.get_time);
for i in 5001..10000 loop
insert into en (id ,name) values(v_id (i),v_name(i));
end loop;
end_time := to_number(dbms_utility.get_time);
dbms_output.put_line(‘总用时为 ’ || (end_time-start_time )/100);
end;
declare
type id_table_type is table of number
index by binary_integer;
type name_table_type is table of varchar2(100)
index by binary_integer;
v_id id_table_type;
v_name name_table_type ;
start_time number(10);
end_time number(10);
begin
for i in 1..5000 loop
v_id (i) := i;
v_name (i) :=’name’|| i ;
end loop;
start_time := to_number(dbms_utility.get_time);
Forall i in 1..v_id.count
insert into en (id ,name) values(v_id (i),v_name(i));
end_time := to_number(dbms_utility.get_time);
dbms_output.put_line(‘总用时为 ’ || (end_time-start_time )/100);
end;
select * from en ;
declare
v_id number(10):=50;
begin
for i in 1..10 loop
dbms_output.put_line( i ||’ ’ );
end loop;
end ;
/indices of 跳过空的 取集合的基数/
–删除1,3
declare
type id_table_type is table of number(10);
v_id id_table_type := id_table_type(1,null,3);
begin
forall i in 1..3
delete from en where id = v_id(i) ;
end;
declare
type id_table_type is table of number(10);
v_id id_table_type := id_table_type(1,null,3);
begin
forall i in indices of v_id —和上面一样 取基数(复数)
delete from en where id = v_id(i) ;
end;
/values of 取集合的下标 /
declare
type id_table_type is table of binary_integer;
v_id id_table_type := id_table_type(2,5,8);
begin
forall i in values of v_id —和上面一样 取集合下标(复数)
delete from en where id = v_id(i) ;
end;
/bulk collect 将查询结果放入集合中 /
declare
type v_table_type is table of en%rowtype;
v_table v_table_type ;
begin
select * bulk collect into v_table from en;
for i in 1..v_table.count loop —和上面一样 取集合下标(复数)
dbms_output.put_line(v_table(i).name || ’ ‘|| v_table(i).id);
end loop;
end;
/* sql%bulk_rowcount */
– 专门为forall 提供的函数,返回第i个元素所影响的行数;
- 批量绑定
- 批量绑定
- PL/SQL批量绑定
- 批量绑定(FORALL)
- oracle12C--批量绑定(63)
- js批量绑定事件
- ORACLE Bulk Binding批量绑定
- oracle批量绑定的概念
- oracle性能提高---批量绑定
- merge 绑定变量批量DML
- jquery实现批量绑定元素
- oracle性能提高---批量绑定
- 批量绑定—BULK COLLECT
- 事件批量绑定器.on
- 如何快速批量绑定IP地址
- 集合方法、赋值、比较 批量绑定
- ORACLE 批量绑定 FORALL 与 BULK COLLECT
- oracle10g批量绑定forall bulk collect
- android scrollview 滑不到最下面
- BP
- char **传参
- 虚拟8086模式
- IO流之字符流(JAVA)
- 批量绑定
- Java定位CPU使用高问题 ——转载
- 线程THread的俩种创建方式
- rabbitmq 发送方确认模式来确认投递——基于pika 0.10.0
- Unity基础包 刚体FPS RigidbodyFirstPersonController 脚本研究
- lucene全文搜索之二:创建索引器(创建IKAnalyzer分词器和索引目录管理)基于lucene5.5.3
- 可变参数函数
- MySQL - 查看慢SQL
- php安装mongodb组件