• MySql新增列的时候判断是否存在


    drop procedure if exists schema_change;
    delimiter ';;';
    create procedure schema_change() begin
        if not exists( select * from information_schema.`COLUMNS` where TABLE_NAME='QYTB_DYAQ' and COLUMN_NAME='BDCQYWBSM') then
            alter table QYTB_DYAQ add BDCQYWBSM CHAR(1);
        end if;
    end;;
    delimiter ';';
    -- 调用存储过程
    call schema_change(); 
    drop procedure if exists schema_change;

    我们通过这段代码感觉只要存储过程的内容体就能实现目的,为什么还要创建一个存储过程来处理呢?

    因为Mysql不支持直接写入如上内容体的格式。于是只能曲线救国了。

  • 相关阅读:
    RedisPlugin
    微信、支付宝授权与支付
    在手机上预览h5项目
    localStorage
    fluter中json的处理
    flutter路由
    一个类实现多个接口
    抽象类、接口
    dart中的类
    方法
  • 原文地址:https://www.cnblogs.com/duanjt/p/13391320.html
Copyright © 2020-2023  润新知