In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
I'm sure oracle beginners will freak out when the leader says to insert thousands of pieces of data into a table. At that time, I inserted dozens of pieces of data into the table. I inserted them sentence by sentence. After dozens of executions, I was crazy. Later, I found that I could insert them in batches, saving a lot of time and energy.
Method 1: Use union all concatenation (this method is similar to inser into, but the execution speed is much faster)
insert into tmp(id,name,salary,address)
select ('001',' Zhang San','100',' Shanghai') from dual
union all
select ('002',' Li Si','200',' Chongqing') from dual
union all
select ('003',' Wangwu','300',' Beijing') from dual;
commit;
Method 2: Insert into... select... (It can be understood as data copying, inserting the data in tmp2 table into tmp1, and then adding where conditions)
insert into tmp1(id,name,salary,address)
select id,name,salary,address from tmp2
(where ...);
commit;
Method 3: Use insert all
insert all
into tmp(id,name,salary,address) values ('001 ',' Zhang San','100',' Shanghai')
into tmp(id,name,salary,address) values ('002 ',' Li Si','200',' Chongqing')
into tmp(id,name,salary,address) values ('003 ',' Wangwu','300',' Beijing')
select 1 from dual;
commit;
In addition, the method also supports inserting data into multiple tables:
insert all
into tmp1(id,name,salary,address) values ('001 ',' Zhang San','100',' Shanghai')
into tmp2(id,name,salary,address) values ('002 ',' Li Si','200',' Chongqing')
into tmp3(id,name,salary,address) values ('003 ',' Wangwu','300',' Beijing')
select 1 from dual;
commit;
Success, no longer because the leader let batch insertion data waste time and overtime!
In addition, we have any better way to welcome the message, we learn progress together! No overtime!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.