database - Regarding multiple insertion of rows through single query.(oracle) -


is mechanism used in multiple insertion of rows in table through single query same of inserting single row single query.if not exact mechanism?

if fetching data existing table, can use insert table3 ( select * table1 union select * table2 ....) fetch , insert data in single go.


sql> select * scott.emp job = 'analyst1';       empno ename      job              mgr hiredate         sal       comm     deptno gender ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------       8909 luthar     analyst1        7698 22-jul-99       1232        788         50 f       8999 aman       analyst1        7698 22-jul-99       8569        788         50 m       7788 scott      analyst1        7566 19-apr-87       3000        150            m       7902 2          analyst1        7566 03-dec-81       3000                       m   sql> select * scott.emp job = 'manager';       empno ename      job              mgr hiredate         sal       comm     deptno gender ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ---------       7566 5          manager         7839 02-apr-81       2975        150            f       7698 10000      manager         7839 01-may-81       2850        150            f       7782 clark      manager         7839 09-jun-81       2450        150            f 

sql> create table emp1 ( select * scott.emp 1=2);  table created.  sql> select * emp1;  no rows selected 

sql> insert emp1 ( select * scott.emp job = 'analyst1'   2  union   3  select * scott.emp job = 'manager');  7 rows created. 

sql> select * emp1;      empno ename      job              mgr hiredate         sal       comm     deptno gender ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- --------       7566 5          manager         7839 02-apr-81       2975        150            f       7698 10000      manager         7839 01-may-81       2850        150            f       7782 clark      manager         7839 09-jun-81       2450        150            f       7788 scott      analyst1        7566 19-apr-87       3000        150            m       7902 2          analyst1        7566 03-dec-81       3000                       m       8909 luthar     analyst1        7698 22-jul-99       1232        788         50 f       8999 aman       analyst1        7698 22-jul-99       8569        788         50 m  7 rows selected. 

Comments

Popular posts from this blog

Javascript line number mapping -

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -