Oracle Insert Multiple rows

Source: Internet
Author: User

1. General insert operation.

  

Use syntax insert INTO table_name[(Column[,column ...])] VALUES (Value[,value ...]) Insert statement, each insert can only be inserted into one of the specified data in the target table. If there are many rows that need to be inserted, and the data is extracted from other tables or tables, this does not satisfy the requirement. So Oracle provides an extension, as described below.

  2.insert into table_name[(Column[,column ...]) select_statement

  

Oracle provides an extension that inserts records queried through a SELECT statement into all columns or columns in the specified table. can only be inserted into one table at a time, but performance is higher than writing many insert statements. In addition, Oracle also provides direct CREATE TABLE table_name as SELECT .... (as can not be less!) ), the implementation directly creates the table and inserts the data, depending on the result of the subsequent SELECT statement, such as copying only the table structure, the constraint is not assigned value, then you can use the CREATE TABLE new_table as SELECT * from source_table where 1=0; --1=0 does not query records, only the basic structure is copied.

For example, there is a need: Table mxt new Column time, then this new column in Oracle will be placed behind all columns, now want to put this time column in the 2nd position, then you can use this action:

The following is a detailed description of Oracle's additional extensions to the insert operation, achieving the goal, an insert operation, inserting into multiple tables, and inserting multiple records into each table.

  3 Insert to multiple targets

There are four types of these:

  

1. Unconditional Insert

2. Insert all with a condition

3. Insert first with a condition

4. Pivoting insert

  Multiple table Insert Usage restrictions:

  

1. You can use multiple table inserts only on table, not on views or materialized view.

2. This insert operation cannot be performed on the remote table.

3. In a multi-table insert operation, you cannot specify a table's set expression.

4. The Into target table in a multi-table insert cannot have more than 999 columns.

Oracle Insert multiple rows (RPM)

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.