Copy Oracle Database Data

Source: Internet
Author: User

-- Two tables for data copying, the most common copy statement
-- Insert into select and select info from
-- Select info from cannot be used in Oracle for a simple reason
-- Select into is a value assignment statement of PL/SQL language.
-- If used, Oracle throws an ORA-00905: Missing keyword exception
-- But this function can be replaced by create table select.
Create Table
(
Id varchar2 (20 ),
Name varchar2 (20)
)
Create Table B
(
Id varchar2 (20 ),
Name varchar2 (20)
)

Insert into a values ('1', 'A ');
Insert into a values ('2', 'B ');
Insert into a values ('3', 'C ');
Select * from
-- Select * into B from
-- Delete table B first. The new table is created during execution and cannot exist in advance.
Create Table B as select * from
Select * from
Select * from B
-- When the insert into SELECT statement is used, table B must exist in advance.
Insert into B select * from

Summary:

We recommend that you use insert into select to copy data;

When using insert into select, if an ID sequence value is generated for the copy table, you must query the sequence in the SELECT statement and insert the copy table;

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.