Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/u012414590/article/details/69372040
A grammar
Full table insert
insert all into table1 values() into table2 values() select * from table
After the execution, all the data in the table will table1 and table2 are inserted
Plus insert conditions
insert all when condition1 then into table1 values() when condition2 then into table2 values() select * from table
After the execution, will satisfy the condition table data is inserted into table1 condition1, data conditions are met condition2 inserted into table2
You can also write:
insert all when condition1 then into table1 values() else into table2 values() select * from table
Syntax two
Conditions insert
insert first when condition1 then into table1 values() when condition2 then into table2 values() select * from table
Difference: the method table for each record in the source table is inserted only once, even if a plurality of conditions is not satisfied repeated insertion