WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR  EXIT FAILURE ROLLBACK;

spool SYS_CONFIG_DIMENSION.log

prompt
prompt Creating table SYS_CONFIG_DIMENSION
prompt ====================================
prompt
whenever sqlerror continue
drop table SYS_CONFIG_DIMENSION; 
whenever sqlerror exit failure rollback

-- Create table
create table SYS_CONFIG_DIMENSION
(
  DIMENSION_CODE      VARCHAR2(100) not null,
  DIMENSION_NAME_ID   NUMBER not null,
  ENABLED_FLAG        VARCHAR2(1) default 'Y',
  LOOKUP_BM           VARCHAR2(500),
  LOOKUP_SCREEN       VARCHAR2(500),
  DESC_LOOKUP_SQL     VARCHAR2(1000),
  DATA_QUERY_SQL      VARCHAR2(1000),
  ORDER_NUM           NUMBER,
  DESCRIPTIONS        VARCHAR2(2000),
  BUILTIN_FLAG        VARCHAR2(1),
  CREATED_BY          NUMBER not null,
  CREATION_DATE       DATE default sysdate not null,
  LAST_UPDATED_BY     NUMBER not null,
  LAST_UPDATE_DATE    DATE default sysdate not null,
  DIMENSION_INIT_PROC VARCHAR2(1000),
  DIMENSION_TAG       VARCHAR2(100)
);
-- Add comments to the columns 
comment on column SYS_CONFIG_DIMENSION.DIMENSION_CODE
  is '维度代码';
comment on column SYS_CONFIG_DIMENSION.DIMENSION_NAME_ID
  is '维度名称，多语言';
comment on column SYS_CONFIG_DIMENSION.ENABLED_FLAG
  is '启用标志';
comment on column SYS_CONFIG_DIMENSION.LOOKUP_BM
  is '选择该维度的记录时，LOV所使用的BM';
comment on column SYS_CONFIG_DIMENSION.LOOKUP_SCREEN
  is '如果不能用通用LOV选择记录，通过此字段设定特定的选择界面';
comment on column SYS_CONFIG_DIMENSION.DESC_LOOKUP_SQL
  is '根据维度值来获取记录描述的SQL';
comment on column SYS_CONFIG_DIMENSION.DATA_QUERY_SQL
  is '从个性化配置表中获取属于该维度记录的sql表达式';
comment on column SYS_CONFIG_DIMENSION.ORDER_NUM
  is '维度优先级顺序号，数字越大优先级越高';
comment on column SYS_CONFIG_DIMENSION.DESCRIPTIONS
  is '描述';
comment on column SYS_CONFIG_DIMENSION.BUILTIN_FLAG
  is '系统内建标志，如果是系统内建的维度，维护界面不能删除';
-- Create/Recreate primary, unique and foreign key constraints 
alter table SYS_CONFIG_DIMENSION
  add primary key (DIMENSION_CODE)
  using index;

spool off
exit
