代码之家  ›  专栏  ›  技术社区  ›  clhost

如果DDL语句崩溃,会发生什么?(Oracle数据库)

  •  0
  • clhost  · 技术社区  · 7 年前

    我只执行了DML语句,我将尝试执行DDL语句,但什么呢

    这样地:

    -- point 1
    
     INSERT ...
    
     INSERT ...
    
     INSERT ...
    

    -- point 2
    
    CREATE ... (crash)
    

    它将返回什么点?第1点还是第2点? 谢谢。

    1 回复  |  直到 7 年前
        1
  •  4
  •   Cyrille MODIANO    7 年前

    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