-- Create table
create table T_MST_DR_REPORT
(
  reportid     NUMBER not null,
  reportcode   NVARCHAR2(32) not null,
  reportname   NVARCHAR2(64) not null,
  commandtype  NVARCHAR2(32),
  sqlscript    NVARCHAR2(2000),
  reportname2  NVARCHAR2(64),
  commandtype2 NVARCHAR2(32),
  sqlscript2   NVARCHAR2(2000),
  remarks      NVARCHAR2(64),
  accountid    NUMBER not null,
  valueflag    CHAR(1) default 1 not null,
  createtime   DATE default sysdate not null,
  createuserid NUMBER not null,
  updatetime   DATE default sysdate not null,
  updateuserid NUMBER not null
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Add comments to the columns 
comment on column T_MST_DR_REPORT.reportid
  is '报表ID';
comment on column T_MST_DR_REPORT.reportcode
  is '报表编码';
comment on column T_MST_DR_REPORT.reportname
  is '报表名称';
comment on column T_MST_DR_REPORT.commandtype
  is '命令类型';
comment on column T_MST_DR_REPORT.sqlscript
  is 'SQL文本';
comment on column T_MST_DR_REPORT.reportname2
  is '报表名称2';
comment on column T_MST_DR_REPORT.commandtype2
  is '命令类型2';
comment on column T_MST_DR_REPORT.sqlscript2
  is 'SQL文本2';
comment on column T_MST_DR_REPORT.remarks
  is '备注';
comment on column T_MST_DR_REPORT.accountid
  is '帐套ID (所属帐套ID)';
comment on column T_MST_DR_REPORT.valueflag
  is '有效标识 (1：正常  0：停用)';
comment on column T_MST_DR_REPORT.createtime
  is '创建时间 (更新时，不更新该数据)';
comment on column T_MST_DR_REPORT.createuserid
  is '创建数据操作员ID (更新时，不更新该数据)';
comment on column T_MST_DR_REPORT.updatetime
  is '更新时间 (新建时，取新建时间；更新时，取最新时间更新)';
comment on column T_MST_DR_REPORT.updateuserid
  is '更新数据操作员ID (新建时，取创建者ID；更新时，取更新者ID)';
-- Create/Recreate primary, unique and foreign key constraints 
alter table T_MST_DR_REPORT
  add primary key (REPORTID)
  using index 
  tablespace USERS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
