INSERT CLAUSE

a.single table insert

INSERT INTO jobs(job_id,job_title,min_salary,Max_Salary)
VALUES('IT_PM','PROJECT MANAGER',5000,11000);

INSERT INTO scott.bonus(ename,job,sal,comm)
SELECT ename,job,sal*.10
FROM scott.emp;

 b.more table insert

create table small_table(
customer_id number,
sum_orders number
);
create table medium_table(
customer_id number,
sum_orders number
);
create table larger_table(
customer_id number,
sum_orders number
);
INSERT ALL
WHEN sum_orders<1000 THEN
INTO small_table
WHEN sum_orders>=1000 AND sum_orders<1000 THEN
INTO medium_table
ELSE
INTO larger_table
SELECT customer_id,SUM(order_total) sum_orders
FROM oe.orders
GROUP BY customer_id;
原文地址:https://www.cnblogs.com/yjhlsbnf/p/7906300.html