PL/SQL USE INSERT... to INSERT multiple rows in a SELECT statement, we usually use the INSERT command to INSERT rows into a table. Sometimes, you need to add specific data to the target table based on the records of existing tables and views, you can use INSERT... SELECT statement. The statement actually contains two parts: INSERT (INSERT statement) and SELECT (query statement). Its syntax can be expressed as follows:
Insert into Table2 (field1, field2,...) select value1, value2,... from Table1, INSERT a large amount of data into the target table at a time using the Insert... SELECT statement. Note the following points when using this statement: the INSERT statement www.2cto.com cannot select data from the table or view being inserted. In the insert into statement, the number of columns must be equal to the number of columns returned from the SELECT statement. In the insert into statement, the Data Type of the column must be the same as that of the column returned by the SELECT statement.
The syntax for the same effect in the T-SQL is as follows: SELECT vale1, value2 into Table2 from Table1. INSERT... SELECT statements are usually used to create a search table, which improves the search performance. A query table can contain data distributed in multiple tables of multiple databases. Because the connection between multiple tables is slower than that of simple tayun, executing SELECT query on a table is much faster than executing a long and complex connection query. Www.2cto.com is working on the outpatient doctor's site project today. You just need to copy some rows from other tables to another table and write down this article. This method is feasible and efficient, as evidenced by the following:
Author: DebugLZQ