﻿--------------------------------------------------------
--  DDL for Table CFG_MATERIAL
--------------------------------------------------------

  CREATE TABLE "MIRLE"."CFG_MATERIAL" 
  (	
	   "MATERIAL_ID" VARCHAR2(30 CHAR), 
	   "MATERIAL_NAME" VARCHAR2(50 CHAR), 
	   "MATERIAL_UNIT" VARCHAR2(3 CHAR) DEFAULT '個', 
	   "MATERIAL_TYPE" NUMBER(1,0), 
	   "MATERIAL_WEIGHT" NUMBER(15,3), 
	   "MATERIAL_SAFE_DAY" NUMBER(3,0), 
	   "PRODUCT_TYPE" VARCHAR2(10 CHAR), 
	   "REMARKS" VARCHAR2(255 CHAR), 
	   "CREATE_USER" VARCHAR2(30 CHAR), 
	   "CREATE_TIME" TIMESTAMP (6) DEFAULT systimestamp, 
	   "UPDATE_USER" VARCHAR2(30 CHAR), 
	   "UPDATE_TIME" TIMESTAMP (6) DEFAULT systimestamp, 
	   "STATUS" NUMBER(1,0) DEFAULT 0
  ) 
  SEGMENT CREATION IMMEDIATE 
  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 FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM" ;

  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."MATERIAL_ID" IS '物料編號';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."MATERIAL_NAME" IS '物料名稱';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."MATERIAL_UNIT" IS '物料單位';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."MATERIAL_TYPE" IS '物料類別';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."MATERIAL_WEIGHT" IS '物料重量(kg)';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."MATERIAL_SAFE_DAY" IS '物料保存天數';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."PRODUCT_TYPE" IS '產品類別';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."REMARKS" IS '備註';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."CREATE_USER" IS '建立人員';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."CREATE_TIME" IS '建立時間';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."UPDATE_USER" IS '更新人員';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."UPDATE_TIME" IS '更新時間';
  COMMENT ON COLUMN "MIRLE"."CFG_MATERIAL"."STATUS" IS '資料狀態';

--------------------------------------------------------
--  DDL for Index CFG_MATERIAL_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MIRLE"."CFG_MATERIAL_PK" ON "MIRLE"."CFG_MATERIAL" ("MATERIAL_ID") 
  PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM" ;

--------------------------------------------------------
--  Constraints for Table CFG_MATERIAL
--------------------------------------------------------

  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("MATERIAL_NAME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("MATERIAL_UNIT" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("MATERIAL_TYPE" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("PRODUCT_TYPE" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("CREATE_USER" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("CREATE_TIME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("UPDATE_USER" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("UPDATE_TIME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("STATUS" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" MODIFY ("MATERIAL_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_MATERIAL" ADD CONSTRAINT "CFG_MATERIAL_PK" PRIMARY KEY ("MATERIAL_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "SYSTEM"  ENABLE;