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

Oracle 21NN 4周前 (06-24) 7次浏览 未收录 0个评论 扫描二维码

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 ”资金实际到账时间”’;   http://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的专栏


21NN.CN , 版权所有丨如未注明 , 均为原创丨转载请注明原文链接:oracle创建表/序列/注释/主键-Oracle
喜欢 (0)
[1353713598@qq.com]
分享 (0)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址