zoukankan      html  css  js  c++  java
  • WHENEVER SQLERROR EXIT AND DDL

    1.
    SQL> create table test_ddl(id int ,name char(10),addr char(20));
    
    Table created.
    
    SQL> desc test_ddl;
    Name    Null?    Type
    ----------------------------------------- -------- ----------------------------
    ID     NUMBER(38)
    NAME     CHAR(10)
    ADDR     CHAR(20)
    
    
    SQL> ! cat all.txt
    WHENEVER SQLERROR EXIT
    @t1.sql
    
    SQL> ! cat t1.sql
    alter table test_ddl add(name char(200));
    alter table test_ddl add(systag char(200));
    
    SQL> 
    
    SQL> @all.txt
    alter table test_ddl add(name char(200))
                             *
    ERROR at line 1:
    ORA-01430: 表中已存在要添加的列
    
    
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@yyjk 20190430]$ sqlplus tlcbuser/tlcbuser
    
    SQL*Plus: Release 11.2.0.4.0 Production on 星期二 4月 30 15:51:28 2019
    
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> desc test_ddl
    Name    Null?    Type
    ----------------------------------------- -------- ----------------------------
    ID     NUMBER(38)
    NAME     CHAR(10)
    ADDR     CHAR(20)
    
    SQL> quit
    
    
    此时遇到错误,直接退出了
    
    
    SQL> desc test_ddl
    Name    Null?    Type
    ----------------------------------------- -------- ----------------------------
    ID     NUMBER(38)
    NAME     CHAR(10)
    ADDR     CHAR(20)
    
    SQL> @t1.sql
    alter table test_ddl add(name char(200))
                             *
    ERROR at line 1:
    ORA-01430: 表中已存在要添加的列
    
    
    
    Table altered.
    
    SQL> desc test_ddl
    Name    Null?    Type
    ----------------------------------------- -------- ----------------------------
    ID     NUMBER(38)
    NAME     CHAR(10)
    ADDR     CHAR(20)
    SYSTAG      CHAR(200)
    
    SQL> 
  • 相关阅读:
    关于form表单的相同name问题
    MySQL数据库视图
    Blazor
    查看Oracle正在执行的任务
    比较不错的几款开源的WPF Charts报表控件
    Raft算法
    EntityFramework 使用Linq处理内连接(inner join)、外链接(left/right outer join)、多表查询
    systemd、upstart和system V 枯木
    MRTG生成首页报错解决方法 枯木
    dd备份和恢复 枯木
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348785.html
Copyright © 2011-2022 走看看