The impact of DDL statements on transactions in Oracle

Source: Internet
Author: User



The effect of DDL statements on transactions in 1.Oracle

In Oracle, when executing DDL statements (such as Create Table, create view, and so on), a commit command is issued automatically before execution and a commit or ROLLBACK command is subsequently issued, which means The DDL executes like this pseudo code:

Commit;ddl_statement;

If (Error) Then

Rollback;

Else

Commit; End if;

We analyze the impact of DDL statements on transactions in Oracle by analyzing the following example:

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

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

Since the commit is committed before Oracle executes the CREATE TABLE statement, and the commit command is issued automatically after the CREATE table executes, only the rows inserted in after are rolled back, and the rows inserted into the before are not rolled back, Create The result of the table command is also not rolled back, even if the CREATE TABLE statement fails, and the before insert is committed. If the commit command was last issued because the result of inserting before and create table was previously committed, the commit command affects only the operation that was inserted after.

The impact of DDL statements on transactions in 2.SQL server

In SQL Server, the effect of a DDL statement on a transaction is the same as other DML statements, that is, the commit command is not issued automatically before or after the DML statement is issued.

In SQL Server 2000, for the same example as Oracle above, after the final rollback is issued, the database is rolled back to the state before the before was inserted, that is, the rows inserted before and after are rolled back, and the data table T is not created.

If a commit is last issued, the results of the three operations are all committed.

Reference: http://www.233.com/oracle/zonghe/20101008/103744390.html
http://blog.csdn.net/fw0124/article/details/6227376

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The effect of DDL statements on transactions in Oracle

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.