Impact of DDL statements on transactions in Oracle

Source: Internet
Author: User

Impact of DDL statements on transactions in Oracle
Zookeeper

1. Impact of DDL statements on transactions in Oracle

In Oracle, when executing DDL statements (such as Create Table and Create View), a Commit command is automatically issued before execution, and a Commit or Rollback command is then issued, that is, DDL is executed like the following pseudo code:

Commit; DDL_Statement;

If (Error) then

Rollback;

Else

Commit; End if;

The following example shows the impact of DDL statements on transactions in Oracle:

Insert into some_table values ('before'); Creaate table T (x int );

Insert into some_table values ('after'); Rollback;

Since the statement is submitted before Oracle executes the Create table statement, and the Commit command is automatically issued After the Create table statement is executed, only the row inserted After is rolled back, the line inserted to Before will not be rolled back, and the result of the Create table command will not be rolled back. Even if the Create table statement fails, the Before insertion will be submitted. If the final Commit command is issued, the Insert Before and Create table operations are submitted Before, so the Commit command only affects the Insert After operation.

2. Impact of DDL statements on transactions in SQL Server

In SQL Server, DDL statements have the same effect on transactions as other DML statements. That is to say, no Commit command is automatically issued before or after a DML statement is issued.

In SQL Server 2000, the database rolls back to the status Before the Before is inserted after Rollback is triggered for the same Oracle example above, that is, the rows inserted to Before and After will be rolled back, and the data table T will not be created.

If a Commit operation is triggered, all the results of the three operations are submitted.

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.