create table TBL_DICTIONARY(id NUMBER,groupname VARCHAR2(20),keyname VARCHAR2(20),keyvalue VARCHAR2(50),createtime DATE,updatetime DATE,remark NVARCHAR2(100))tablespace TS_JKpctfree 10initrans 1maxtrans 255storage(initial 64Knext 1Mminextents 1maxextents unlimited);--设置自增alter table tbl_dictionaryadd constraint dictionary_id primary key (ID)using indextablespace TS_PTpctfree 10initrans 2maxtrans 255storage(initial 64Knext 1Mminextents 1maxextents unlimited);--如果自增数据库版本不允许,设置触发器达到自增效果create sequence tbl_dictionary_autoidstart with 1increment by 1minvalue 1nomaxvalue;create or replace trigger TR_MTJK_tbl_dictionarybefore insert on tbl_dictionary --"userinfo"为表名称for each rowbeginselect 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_JKpctfree 10initrans 1maxtrans 255storage(initial 64Knext 1Mminextents 1maxextents unlimited);--设置自增alter table TBL_ERRORLOGadd constraint LOG_ID primary key (ID)using indextablespace TS_PTpctfree 10initrans 2maxtrans 255storage(initial 64Knext 1Mminextents 1maxextents unlimited);--如果自增数据库版本不允许,设置触发器达到自增效果create sequence tbl_errorlog_autoidstart with 1increment by 1minvalue 1nomaxvalue;create or replace trigger TR_MTJK_TBL_ERRORLOGbefore insert on TBL_ERRORLOG --"userinfo"为表名称for each rowbeginselect 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_JKpctfree 10initrans 1maxtrans 255storage(initial 64Knext 8Kminextents 1maxextents unlimited);-- Add comments to the columnscomment on column TBL_REPORT_RECORD.hisexamineenumis '体检编号';comment on column TBL_REPORT_RECORD.statusis '报告状态:0:失败 1:成功';--设置自增alter table TBL_REPORT_RECORDadd constraint tbl_report_ID primary key (ID)using indextablespace TS_PTpctfree 10initrans 2maxtrans 255storage(initial 64Knext 1Mminextents 1maxextents unlimited);--如果自增数据库版本不允许,设置触发器达到自增效果create sequence tbl_report_record_autoidstart with 1increment by 1minvalue 1nomaxvalue;create or replace trigger TR_MTJK_TBL_REPORT_RECORDbefore insert on TBL_REPORT_RECORD --"userinfo"为表名称for each rowbeginselect TBL_REPORT_RECORD_autoid.nextval into:new.id from dual;end;
文档更新时间: 2023-07-17 17:12