今天看到侯圣文的博客,有insert的测试,我突然有兴趣, 我也试了一把,果然不错。
另外: 我还有个爱好,就是把大师的博客一一测试,把他们变为自己的东西,侯大师是一个幽默的人,从bolg一一读下来,感受到他的成长,还有生活的点点滴滴,确实搞IT就是一个坚持, 量变到质变的过程, 等以后我回过来看这篇文章的时候,也许是另一个高度了,或者已经转行。
--下图就是官方文档的图, 所以我还佩服另一个人, 俗称:“oracle百科全书” - 杨长老。 确实应该读官方文档。 老杨连坐出租车都要打开mac读文档,佩服。
SQL> create table ml_1 as select OBJECT_NAME,OBJECT_TYPE from user_objects where 0 = 1;
Table created
SQL> create table ml_2 as select OBJECT_NAME,OBJECT_TYPE from user_objects where 0 = 1;
Table created
SQL> create table ml_3 as select OBJECT_NAME,OBJECT_TYPE from user_objects where 0 = 1;
Table created
SQL> select count(*) from user_objects;
COUNT(*)
----------
12453
SQL> select count(*) from ml_1;
COUNT(*)
----------
0
SQL> select count(*) from ml_2;
COUNT(*)
----------
0
SQL> select count(*) from ml_3;
COUNT(*)
----------
0
SQL>
SQL>
SQL>
SQL>
SQL> INSERT ALL
2 WHEN (object_type IN ('TABLE'))
3 THEN
4 INTO ml_1 (OBJECT_NAME, OBJECT_TYPE)
5 VALUES (OBJECT_NAME, OBJECT_TYPE)
6 WHEN (object_type IN ('SEQUENCE'))
7 THEN
8 INTO ml_2 (OBJECT_NAME, OBJECT_TYPE)
9 VALUES (OBJECT_NAME, OBJECT_TYPE)
10 ELSE
11 INTO ml_3 (OBJECT_NAME, OBJECT_TYPE)
12 VALUES (OBJECT_NAME, OBJECT_TYPE)
13 SELECT OBJECT_NAME, OBJECT_TYPE FROM user_objects
14 ;
12453 rows inserted
SQL>