zoukankan      html  css  js  c++  java
  • 【DB示例】如果数据库表不存在,则创建

    1、oracle 数据库

    declare  cnt number;

    begin   

    select count(*)into cnt from user_tables where table_name='ENTRY_MODIFYSTATUS';   

    if cnt=0

    then  execute immediate 'create table ENTRY_MODIFYSTATUS  (       

    ENTRY_ID             VARCHAR2(18)                    not null,       

    APPLY_TIME           DATE                            not null,       

    STATUS               NUMBER(2),       

    constraint PK_ENTRY_MODIFYSTATUS

    primary key (ENTRY_ID, APPLY_TIME)     )';  

    end if;   

    cnt:=0;

    end;

    /

    2、sqlserver数据库

    use tam

    go

    IF  NOT EXISTS(SELECT  * FROM sysobjects WHERE name = 'sunzx' and type='U')

    begin   

    CREATE TABLE tam.[dbo].[sunzx] (    

    [col1] int IDENTITY(1,1) NOT NULL,    

    [col2] varchar(20) NULL    

    )

    end

    go

    3、mysql 数据库

    create table if not exists OMSSM.TOKEN12(    

    ID VARCHAR(255),    

    USERID VARCHAR(255),    

      PRIMARY KEY ( ID )

    );

  • 相关阅读:
    12. nc/netcat 用法举例
    7. 由一道ctf学习变量覆盖漏洞
    11. 几点基于Web日志的Webshell检测思路
    约瑟夫环
    栈结构的经典算法题
    二叉查找树之二
    fork与vfork
    数组常见算法题
    赛马问题
    fibonacci 数列及其应用
  • 原文地址:https://www.cnblogs.com/haifeisi/p/3259199.html
Copyright © 2011-2022 走看看