热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

oracle创建表/序列/注释/主键

DECLAREiCountnumber(2):0;BEGINSELECTCOUNT(*)INTOiCountFROMuser_sequencesuWHEREu.sequence_name'SEQ_TCAPITALNOTIFY';www.2cto.comIFiCount0...

DECLARE
   iCount   number(2) := 0;
BEGIN
   SELECT COUNT (*) INTO iCount FROM   user_sequences u WHERE   u.sequence_name = 'SEQ_TCAPITALNOTIFY';  www.2cto.com  
   IF iCount = 0
   THEN
      /*创建序列*/
      EXECUTE IMMEDIATE 'create sequence SEQ_TCAPITALNOTIFY minvalue 1 nomaxvalue start with 1 increment by 1';
   END IF;   
    SELECT COUNT (*) INTO iCount FROM   user_tables u WHERE   u.TABLE_NAME = 'TCAPITALNOTIFY';
   IF iCount = 0
   THEN
     /*创建表TCAPITALNOTIFY*/
      EXECUTE IMMEDIATE 'create table TCAPITALNOTIFY(
        L_SERIALNO               number(11)   not null primary key,
        D_DATE                   DATE  not null,
        C_CUSTNO                 varchar2(12)   not null,
        F_BALENCE                NUMBER(16,2),
        C_FUNDCODE               VARCHAR2(6),          
        D_REPLYPAYTIME           DATE,
        C_ORGCONTACT             VARCHAR2(2000),
        C_ORGTEL                 VARCHAR2(2000),
        D_NOTIFICATIONTIME       DATE,
        C_ISCERTIFICATE          CHAR(1),
        C_REALPAYTIME            DATE,
        C_MEMO                   CHAR(1),
        C_ISCANCEL               VARCHAR2(2000),
        C_CREATOR                VARCHAR2(16),
        D_CREATEDATE             DATE
       ) nologging tablespace crm_htable';  www.2cto.com  
       EXECUTE IMMEDIATE 'comment on table  TCAPITALNOTIFY is ''资金通知情况表''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.L_SERIALNO is ''序列号''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.D_DATE is ''日期''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_CUSTNO is ''账户名称''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.F_BALENCE is ''购买资金(元)''';      
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_FUNDCODE is ''购买产品''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.D_REPLYPAYTIME is ''机构答复资金划拨时间''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_ORGCONTACT is ''机构联系人''';      
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_ORGTEL is ''机构联系电话''';
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.D_NOTIFICATIONTIME is ''我方通知时间''';     
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_ISCERTIFICATE is ''是否提供划款凭证''';      
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_REALPAYTIME is ''资金实际到账时间''';   www.2cto.com       
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_ISCANCEL is ''撤单''';    
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_MEMO is ''备注''';        
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.C_CREATOR is ''创建人''';       
       EXECUTE IMMEDIATE 'comment on column TCAPITALNOTIFY.D_CREATEDATE is ''创建日期''';
   END IF;    
END;
/
 
 
摘自 fujianianhua的专栏

推荐阅读
author-avatar
风光好风光好啊_229
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有