Oracle 表脚本备忘
DROP TABLE "TASKITEM";
CREATE TABLE "TASKITEM"
("TASKITEMID" NUMBER NOT NULL ENABLE,
"MODIFYCOUNT" NUMBER DEFAULT 0,
"SYSTEMGROUPID" NUMBER DEFAULT 0 NOT NULL ENABLE,
"DESCRIPTION" VARCHAR2(400),
"MAKERUSERID" NUMBER DEFAULT 0 NOT NULL ENABLE,
"PLANENDDATE" DATE,
"ACTUALENDDATE" DATE,
"MADETIME" DATE,
"REMINDTIME" DATE,
"DROPTIME" DATE,
"STATUS" NUMBER DEFAULT 1,
"ANNOTATION" VARCHAR2(400),
"TASKACCEPTANCETYPEID" NUMBER DEFAULT 0 NOT NULL ENABLE,
"ISIMPORTANT" NUMBER DEFAULT 0 NOT NULL ENABLE,
"ASPID" NUMBER DEFAULT 0 NOT NULL ENABLE,
"TASKLEADER" NUMBER DEFAULT 0,
"PERSONALAPPROVE" NUMBER DEFAULT 0,
"DEPARTMENTAPPROVE" NUMBER DEFAULT 0,
"COMPANYAPPROVE" NUMBER DEFAULT 0,
"MODIFIER" NUMBER DEFAULT 0,
"DELAYDAYS" NUMBER DEFAULT 0,
"ANNOTATION1" VARCHAR2(400),
"ANNOTATION2" VARCHAR2(400),
"ANNOTATION3" VARCHAR2(400),
"ANNOTATION4" VARCHAR2(400),
"ANNOTATION5" VARCHAR2(400),
"VISIBLE" NUMBER DEFAULT 1 NOT NULL ENABLE,
"ASSISTMANAGERAPPROVE" NUMBER DEFAULT 0 NOT NULL ENABLE,
"MONTHITEMID" NUMBER DEFAULT 0 NOT NULL ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS"
;
--创建序列
CREATE SEQUENCE "SU_TASKITEM" INCREMENT BY 1 START WITH 1 MAXVALUE 1.0E27
MINVALUE 1 NOCYCLE CACHE 20 ORDER;
-- ----------------------------
-- 创建触发器(主键自增)
-- ----------------------------
CREATE OR REPLACE TRIGGER "TU_TASKITEM" BEFORE INSERT ON "TASKITEM" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW
BEGIN IF :new.TASKITEMID IS NULL THEN
SELECT SU_TASKITEM.NEXTVAL INTO :new.TASKITEMID
FROM dual;
END IF;
END;;
by archie
posted on 2011-10-30 10:20 archie2010 阅读(227) 评论(0) 编辑 收藏 举报