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

Oracle 21NN 5个月前 (06-24) 16次浏览 已收录 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的专栏


本文:oracle创建表/序列/注释/主键-Oracle 本文链接:https://www.21nn.cn/shujuku/oracle/40278.html 本站所以图片、文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如有侵权请邮件与我们联系处理。i@ki4.cn
喜欢 (0)
[1353713598@qq.com]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

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

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