1. create table TBL_DICTIONARY
  2. (
  3. id NUMBER,
  4. groupname VARCHAR2(20),
  5. keyname VARCHAR2(20),
  6. keyvalue VARCHAR2(50),
  7. createtime DATE,
  8. updatetime DATE,
  9. remark NVARCHAR2(100)
  10. )
  11. tablespace TS_JK
  12. pctfree 10
  13. initrans 1
  14. maxtrans 255
  15. storage
  16. (
  17. initial 64K
  18. next 1M
  19. minextents 1
  20. maxextents unlimited
  21. );
  22. --设置自增
  23. alter table tbl_dictionary
  24. add constraint dictionary_id primary key (ID)
  25. using index
  26. tablespace TS_PT
  27. pctfree 10
  28. initrans 2
  29. maxtrans 255
  30. storage
  31. (
  32. initial 64K
  33. next 1M
  34. minextents 1
  35. maxextents unlimited
  36. );
  37. --如果自增数据库版本不允许,设置触发器达到自增效果
  38. create sequence tbl_dictionary_autoid
  39. start with 1
  40. increment by 1
  41. minvalue 1
  42. nomaxvalue;
  43. create or replace trigger TR_MTJK_tbl_dictionary
  44. before insert on tbl_dictionary --"userinfo"为表名称
  45. for each row
  46. begin
  47. select tbl_dictionary_autoid.nextval into:new.id from dual;
  48. end;

  1. create table TBL_ERRORLOG
  2. (
  3. METHODCODE VARCHAR2(100),
  4. REQUEST NVARCHAR2(2000),
  5. ERRORCODE NVARCHAR2(50),
  6. ERRORMSG NVARCHAR2(1000),
  7. STATUS NUMBER default 0,
  8. RELATEDID VARCHAR2(20),
  9. MEMO NVARCHAR2(500),
  10. CREATEDATE DATE,
  11. UPDATEDATE DATE,
  12. ID NUMBER not null
  13. )
  14. tablespace TS_JK
  15. pctfree 10
  16. initrans 1
  17. maxtrans 255
  18. storage
  19. (
  20. initial 64K
  21. next 1M
  22. minextents 1
  23. maxextents unlimited
  24. );
  25. --设置自增
  26. alter table TBL_ERRORLOG
  27. add constraint LOG_ID primary key (ID)
  28. using index
  29. tablespace TS_PT
  30. pctfree 10
  31. initrans 2
  32. maxtrans 255
  33. storage
  34. (
  35. initial 64K
  36. next 1M
  37. minextents 1
  38. maxextents unlimited
  39. );
  40. --如果自增数据库版本不允许,设置触发器达到自增效果
  41. create sequence tbl_errorlog_autoid
  42. start with 1
  43. increment by 1
  44. minvalue 1
  45. nomaxvalue;
  46. create or replace trigger TR_MTJK_TBL_ERRORLOG
  47. before insert on TBL_ERRORLOG --"userinfo"为表名称
  48. for each row
  49. begin
  50. select tbl_errorlog_autoid.nextval into:new.id from dual;
  51. end;

  1. create table TBL_REPORT_RECORD
  2. (
  3. ID NUMBER not null ,
  4. hisexamineenum VARCHAR2(50),
  5. status NUMBER default 0,
  6. createtime DATE default sysdate,
  7. updatetime DATE default sysdate,
  8. reportTime DATE
  9. )
  10. tablespace TS_JK
  11. pctfree 10
  12. initrans 1
  13. maxtrans 255
  14. storage
  15. (
  16. initial 64K
  17. next 8K
  18. minextents 1
  19. maxextents unlimited
  20. );
  21. -- Add comments to the columns
  22. comment on column TBL_REPORT_RECORD.hisexamineenum
  23. is '体检编号';
  24. comment on column TBL_REPORT_RECORD.status
  25. is '报告状态:0:失败 1:成功';
  26. --设置自增
  27. alter table TBL_REPORT_RECORD
  28. add constraint tbl_report_ID primary key (ID)
  29. using index
  30. tablespace TS_PT
  31. pctfree 10
  32. initrans 2
  33. maxtrans 255
  34. storage
  35. (
  36. initial 64K
  37. next 1M
  38. minextents 1
  39. maxextents unlimited
  40. );
  41. --如果自增数据库版本不允许,设置触发器达到自增效果
  42. create sequence tbl_report_record_autoid
  43. start with 1
  44. increment by 1
  45. minvalue 1
  46. nomaxvalue;
  47. create or replace trigger TR_MTJK_TBL_REPORT_RECORD
  48. before insert on TBL_REPORT_RECORD --"userinfo"为表名称
  49. for each row
  50. begin
  51. select TBL_REPORT_RECORD_autoid.nextval into:new.id from dual;
  52. end;


文档更新时间: 2023-07-17 17:12