如果 DDL 语句崩溃会怎样? (甲骨文数据库)

What happens if the DDL statement will crashes? (Oracle DB)

问题是: 我只执行了 DML 语句,我将尝试执行 DDL 语句,但是什么 如果 DDL 失败会发生什么?是否只有 DDL 或 DML 也会回滚?

像这样:

-- point 1

 INSERT ...

 INSERT ...

 INSERT ...

// 插入 3 行

-- point 2

CREATE ... (crash)

会是什么点return?第 1 点还是第 2 点? 非常感谢。

即使失败,DDL 也会隐式提交您的事务,这里是 Ask tom 的示例:

create table t (
  x int
);

insert into t values (1);

alter table t add (x varchar2(10)); -- duplicate column

SQL Error: ORA-01430: column being added already exists in table

rollback;

select * from t;

X  
1  

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9532421900346923086