create table TBL_DICTIONARY
(
id NUMBER,
groupname VARCHAR2(20),
keyname VARCHAR2(20),
keyvalue VARCHAR2(50),
createtime DATE,
updatetime DATE,
remark NVARCHAR2(100)
)
tablespace TS_JK
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
--设置自增
alter table tbl_dictionary
add constraint dictionary_id primary key (ID)
using index
tablespace TS_PT
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
--如果自增数据库版本不允许,设置触发器达到自增效果
create sequence tbl_dictionary_autoid
start with 1
increment by 1
minvalue 1
nomaxvalue;
create or replace trigger TR_MTJK_tbl_dictionary
before insert on tbl_dictionary --"userinfo"为表名称
for each row
begin
select tbl_dictionary_autoid.nextval into:new.id from dual;
end;
create table TBL_ERRORLOG
(
METHODCODE VARCHAR2(100),
REQUEST NVARCHAR2(2000),
ERRORCODE NVARCHAR2(50),
ERRORMSG NVARCHAR2(1000),
STATUS NUMBER default 0,
RELATEDID VARCHAR2(20),
MEMO NVARCHAR2(500),
CREATEDATE DATE,
UPDATEDATE DATE,
ID NUMBER not null
)
tablespace TS_JK
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
--设置自增
alter table TBL_ERRORLOG
add constraint LOG_ID primary key (ID)
using index
tablespace TS_PT
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
--如果自增数据库版本不允许,设置触发器达到自增效果
create sequence tbl_errorlog_autoid
start with 1
increment by 1
minvalue 1
nomaxvalue;
create or replace trigger TR_MTJK_TBL_ERRORLOG
before insert on TBL_ERRORLOG --"userinfo"为表名称
for each row
begin
select tbl_errorlog_autoid.nextval into:new.id from dual;
end;
create table TBL_REPORT_RECORD
(
ID NUMBER not null ,
hisexamineenum VARCHAR2(50),
status NUMBER default 0,
createtime DATE default sysdate,
updatetime DATE default sysdate,
reportTime DATE
)
tablespace TS_JK
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 8K
minextents 1
maxextents unlimited
);
-- Add comments to the columns
comment on column TBL_REPORT_RECORD.hisexamineenum
is '体检编号';
comment on column TBL_REPORT_RECORD.status
is '报告状态:0:失败 1:成功';
--设置自增
alter table TBL_REPORT_RECORD
add constraint tbl_report_ID primary key (ID)
using index
tablespace TS_PT
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
--如果自增数据库版本不允许,设置触发器达到自增效果
create sequence tbl_report_record_autoid
start with 1
increment by 1
minvalue 1
nomaxvalue;
create or replace trigger TR_MTJK_TBL_REPORT_RECORD
before insert on TBL_REPORT_RECORD --"userinfo"为表名称
for each row
begin
select TBL_REPORT_RECORD_autoid.nextval into:new.id from dual;
end;
文档更新时间: 2023-07-17 17:12