﻿--------------------------------------------------------
--  DDL for Table CUR_MATERIAL_DATA
--------------------------------------------------------

  CREATE TABLE "MIRLE"."CUR_MATERIAL_DATA" 
   (	
	   "STORAGE_ID" VARCHAR2(6 CHAR), 
	   "LOC_ID" VARCHAR2(9 CHAR), 
	   "CMD_SNO" VARCHAR2(16 CHAR), 
	   "CARRIER_ID" VARCHAR2(64 CHAR), 
	   "MATERIAL_ID" VARCHAR2(30 CHAR), 
	   "MATERIAL_BATCH" NUMBER(5,0), 
	   "MATERIAL_QUANTITY" NUMBER(5,0) DEFAULT 1, 
	   "MATERIAL_WEIGHT" NUMBER(15,3), 
	   "PROGRAM_NAME" VARCHAR2(30 CHAR), 
	   "UPDATE_TIME" TIMESTAMP (6)
  ) 
  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"."CUR_MATERIAL_DATA"."STORAGE_ID" IS '儲存區編號';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."LOC_ID" IS '儲位編號';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."CMD_SNO" IS '命令序號';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."CARRIER_ID" IS '載具編號';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."MATERIAL_ID" IS '物料編號';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."MATERIAL_BATCH" IS '物料批號';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."MATERIAL_QUANTITY" IS '物料數量';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."MATERIAL_WEIGHT" IS '物料重量(kg)';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."PROGRAM_NAME" IS '程式名稱';
  COMMENT ON COLUMN "MIRLE"."CUR_MATERIAL_DATA"."UPDATE_TIME" IS '更新時間';

--------------------------------------------------------
--  DDL for Index CUR_MATERIAL_DATA_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MIRLE"."CUR_MATERIAL_DATA_PK" ON "MIRLE"."CUR_MATERIAL_DATA" ("STORAGE_ID", "LOC_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 CUR_MATERIAL_DATA
--------------------------------------------------------

  ALTER TABLE "MIRLE"."CUR_MATERIAL_DATA" MODIFY ("STORAGE_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_MATERIAL_DATA" MODIFY ("LOC_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_MATERIAL_DATA" MODIFY ("CMD_SNO" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_MATERIAL_DATA" MODIFY ("CARRIER_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_MATERIAL_DATA" MODIFY ("MATERIAL_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_MATERIAL_DATA" ADD CONSTRAINT "CUR_MATERIAL_DATA_PK" PRIMARY KEY ("STORAGE_ID", "LOC_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;