Comparison between insert into and select into statements in ORACLE

Source: Internet
Author: User

In ORACLE, the insert into and select into statements are compared. In oracle databases, we commonly use the insert into TableName (column1, column1,...) statement to insert Table data ,...) values (value1, value2 ,...), this is the most basic table data insert statement in the development process. We often insert data records through insert. During the process of development and testing, we often find that we do not want to insert the queried statements through a FOR loop, we know that SQL is not a record-oriented but a data set. oracle also provides the following two methods to insert the queried data into the database at a time. 1. insert into select (the table to be inserted must exist) Syntax 1: insert into TableName1 (column1, column1 ,...) SELECT value1, value2 ,.. FROM TableName2 if the table data is determined to be consistent, you can also directly use the following method syntax 2 insert into TableName1 SELECT * FROM TableName2 or insert into TableName1 SELECT value1, value2 ,.. FROM TableName2 syntax 2 requires that the field type of each field is or can be automatically converted. 2. select into (the table to be inserted does not exist) Syntax: SELECT value1, value2 ,... when you insert INTO TableName2 FROM TableName1, TableName2 is automatically created.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.