当前位置:Gxlcms > 数据库问题 > oracle 创建表同时添加注释

oracle 创建表同时添加注释

时间:2021-07-01 10:21:17 帮助过:316人阅读

table WARNINGRECORD ( RecordID varchar(36) primary key not null ); comment on column WARNINGRECORD.RecordID is 告警编号;


现在想通过pl/sql语句块执行,代码如下:

declare tableExist number;
begin
    Select count(1) into tableExist from all_tables where TABLE_NAME=WARNINGRECORD;
    if tableExist>0 then
        execute immediate drop table WARNINGRECORD;
        return;
    end if;
    execute immediate CREATE TABLE WARNINGRECORD(RecordID varchar(36) PRIMARY KEY NOT NULL);
    execute immediate COMMENT ON COLUMN WarningRecord.RecordID  IS ‘‘告警编号‘‘‘;
end;

 

oracle 创建表同时添加注释

标签:har   prim   creat   table   immediate   blog   sql语句   exist   media   

人气教程排行