﻿--------------------------------------------------------
--  DDL for Table CFG_STORAGE
--------------------------------------------------------

  CREATE TABLE "MIRLE"."CFG_STORAGE" 
  (	
	  "WAREHOUSE_ID" VARCHAR2(5 CHAR), 
	  "STORAGE_ID" VARCHAR2(7 CHAR), 
	  "STORAGE_NAME" VARCHAR2(30 CHAR), 
	  "STORAGE_DESC" VARCHAR2(50 CHAR),
	  "STORAGE_TYPE" NUMNER(1,0),
	  "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_STORAGE"."WAREHOUSE_ID" IS '倉庫編號';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."STORAGE_ID" IS '儲存區編號';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."STORAGE_NAME" IS '儲存區名稱';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."STORAGE_DESC" IS '儲存區敘述';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."STORAGE_TYPE" IS '儲存區類別';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."CREATE_USER" IS '建立人員';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."CREATE_TIME" IS '建立時間';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."UPDATE_USER" IS '更新人員';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."UPDATE_TIME" IS '更新時間';
  COMMENT ON COLUMN "MIRLE"."CFG_STORAGE"."STATUS" IS '資料狀態';

--------------------------------------------------------
--  DDL for Index CFG_STORAGE_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MIRLE"."CFG_STORAGE_PK" ON "MIRLE"."CFG_STORAGE" ("WAREHOUSE_ID", "STORAGE_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_STORAGE
--------------------------------------------------------

  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("WAREHOUSE_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("STORAGE_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("STORAGE_TYPE" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("CREATE_USER" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("CREATE_TIME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("UPDATE_USER" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("UPDATE_TIME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" MODIFY ("STATUS" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CFG_STORAGE" ADD CONSTRAINT "CFG_STORAGE_PK" PRIMARY KEY ("WAREHOUSE_ID", "STORAGE_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;