﻿--------------------------------------------------------
--  DDL for Table CUR_TASK_MST
--------------------------------------------------------

  CREATE TABLE "MIRLE"."CUR_TASK_MST" 
  (	
	  "CMD_SNO" VARCHAR2(20 CHAR), 
	  "TASK_ID" VARCHAR2(16 CHAR), 
	  "CMD_ID" VARCHAR2(6 CHAR), 
	  "TASK_STATUS" NUMBER(1,0) DEFAULT 0, 
	  "TASK_MODE" NUMBER(2,0), 
	  "TASK_SEQ" NUMBER(3,0) DEFAULT 1, 
	  "PRIORITY" NUMBER(1,0), 
	  "SOURCE_POSITION" VARCHAR2(9 CHAR), 
	  "DEST_POSITION" VARCHAR2(9 CHAR), 
	  "CARRIER_ID" VARCHAR2(50 CHAR), 
	  "SOFTWARE_ID" VARCHAR2(7 CHAR), 
	  "VEHICLE_ID" VARCHAR2(30 CHAR), 
	  "CREATE_TIME" TIMESTAMP (6) DEFAULT systimestamp, 
	  "SEND_TIME" TIMESTAMP (6), 
	  "START_TIME" TIMESTAMP (6), 
	  "END_TIME" TIMESTAMP (6), 
	  "FAILED_REASON" VARCHAR2(255 CHAR), 
	  "PROGRAM_NAME" VARCHAR2(30 CHAR)
  ) 
  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_TASK_MST"."CMD_SNO" IS '命令序號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."TASK_ID" IS '任務編號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."CMD_ID" IS '命令編號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."TASK_STATUS" IS '任務狀態';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."TASK_MODE" IS '任務模式';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."TASK_SEQ" IS '任務流水號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."PRIORITY" IS '任務優先權';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."SOURCE_POSITION" IS '起始位置';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."DEST_POSITION" IS '目的位置';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."CARRIER_ID" IS '載具編號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."SOFTWARE_ID" IS '軟體編號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."VEHICLE_ID" IS '設備編號';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."CREATE_TIME" IS '建立時間';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."SEND_TIME" IS '傳送時間';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."START_TIME" IS '起始時間';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."END_TIME" IS '結束時間';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."FAILED_REASON" IS '失敗原因';
  COMMENT ON COLUMN "MIRLE"."CUR_TASK_MST"."PROGRAM_NAME" IS '程式名稱';

--------------------------------------------------------
--  DDL for Index CUR_TASK_MST_PK
--------------------------------------------------------

  CREATE UNIQUE INDEX "MIRLE"."CUR_TASK_MST_PK" ON "MIRLE"."CUR_TASK_MST" ("CMD_SNO", "TASK_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_TASK_MST
--------------------------------------------------------

  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("CARRIER_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("CMD_SNO" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("TASK_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("CMD_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("TASK_STATUS" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("TASK_MODE" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("TASK_SEQ" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("PRIORITY" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("SOURCE_POSITION" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("DEST_POSITION" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("SOFTWARE_ID" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("CREATE_TIME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" MODIFY ("PROGRAM_NAME" NOT NULL ENABLE);
  ALTER TABLE "MIRLE"."CUR_TASK_MST" ADD CONSTRAINT "CUR_TASK_MST_PK" PRIMARY KEY ("CMD_SNO", "TASK_ID")
  USING INDEX "MIRLE"."CUR_TASK_MST_PK"  ENABLE;