步骤如下:
步骤一:新建需要创建的表如:
-- Create table create table IRC_SYS_DATADIC (
datadic_id VARCHAR2(64) not null,
datadic_key VARCHAR2(100),
datadic_val VARCHAR2(100),
datadic_module VARCHAR2(100),
datadic_mark VARCHAR2(100),
datadic_submodule VARCHAR2(100),
cre_time TIMESTAMP(6),
mod_time TIMESTAMP(6),
is_enable VARCHAR2(10),
reservel_var VARCHAR2(100),
reservel_num INTEGER )
tablespace CAAS pctfree 10 initrans 1 maxtrans 255 storage ( initial 64 minextents 1 maxextents unlimited ); -- Add comments to the columns comment on column IRC_SYS_DATADIC.datadic_id is '数据字典主键id';
comment on column IRC_SYS_DATADIC.datadic_key is '数据字典对应的key值';
comment on column IRC_SYS_DATADIC.datadic_val is '数据字典对应的value值';
comment on column IRC_SYS_DATADIC.datadic_module is '数据字典所属的模块';
comment on column IRC_SYS_DATADIC.datadic_mark is '数据字典所对应的特殊标识';
comment on column IRC_SYS_DATADIC.datadic_submodule is '数据字典所属模块的子模块'; comment on column IRC_SYS_DATADIC.cre_time is '创建时间';
comment on column IRC_SYS_DATADIC.mod_time is '修改时间';
comment on column IRC_SYS_DATADIC.is_enable is '是否启用标识(启用为1,不启用为0)'; comment on column IRC_SYS_DATADIC.reservel_var is '预留字段字符型';
comment on column IRC_SYS_DATADIC.reservel_num is '预留字段数值型';
-- Create/Recreate primary, unique and foreign key constraints alter table IRC_SYS_DATADIC add constraint PK_DATADIC_ID primary key (DATADIC_ID) using index tablespace CAAS pctfree 10 initrans 2 maxtrans 255 storage ( initial 64K minextents 1 maxextents unlimited );
步骤二:新建sequence
-- Create sequence create sequence SEQ_IRC_SYS_DATADIC minvalue 1 maxvalue 999999999 start with 21 increment by 1 cache 20;
步骤三:新建触发器
create or replace trigger TRI_IRC_SYS_DATADICr
before insert on IRC_SYS_DATADIC
for each row
declare begin select SEQ_IRC_SYS_DATADIC.nextval into :new.DATADIC_ID from dual;
end TRI_IRC_SYS_DATADICr;