-- ----------------------------
-- Table structure for T_CM_AIRPORT
-- ----------------------------
DROP TABLE "LICHANGLIN"."T_CM_AIRPORT";
CREATE TABLE "LICHANGLIN"."T_CM_AIRPORT" (
  "ID" NUMBER(9) NOT NULL ,
  "NAME" NVARCHAR2(40) NOT NULL ,
  "LONGITUDE" NUMBER(11,6) NOT NULL ,
  "LATITUDE" NUMBER(11,6) NOT NULL ,
  "HEIGHT" NUMBER(6,2) NOT NULL ,
  "ISDELETE" NVARCHAR2(1) DEFAULT 1    ,
  "IMPORTTIME" DATE ,
  "NOTE" NVARCHAR2(160) DEFAULT 1   
 ,
  "NATION" VARCHAR2(5 BYTE) 
)
TABLESPACE "LICHANGLIN"
LOGGING
NOCOMPRESS
PCTFREE 10
INITRANS 1
STORAGE (
  INITIAL 65536 
  NEXT 1048576 
  MINEXTENTS 1
  MAXEXTENTS 2147483645
  BUFFER_POOL DEFAULT
)
PARALLEL 1
NOCACHE
DISABLE ROW MOVEMENT
;

-- ----------------------------
-- Primary Key structure for table T_CM_AIRPORT
-- ----------------------------
ALTER TABLE "LICHANGLIN"."T_CM_AIRPORT" ADD CONSTRAINT "SYS_C0011077" PRIMARY KEY ("ID");

-- ----------------------------
-- Checks structure for table T_CM_AIRPORT
-- ----------------------------
ALTER TABLE "LICHANGLIN"."T_CM_AIRPORT" ADD CONSTRAINT "SYS_C0011044" CHECK ("ID" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "LICHANGLIN"."T_CM_AIRPORT" ADD CONSTRAINT "SYS_C0011045" CHECK ("NAME" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "LICHANGLIN"."T_CM_AIRPORT" ADD CONSTRAINT "SYS_C0011046" CHECK ("LONGITUDE" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "LICHANGLIN"."T_CM_AIRPORT" ADD CONSTRAINT "SYS_C0011047" CHECK ("LATITUDE" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "LICHANGLIN"."T_CM_AIRPORT" ADD CONSTRAINT "SYS_C0011048" CHECK ("HEIGHT" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;

create sequence SEQ_CM_AIRPORT      minvalue 1   maxvalue 999999999999999999999999999999 start with 1      increment by 1     nocycle        nocache;
  
-- ----------------------------
-- Triggers structure for table T_CM_AIRPORT
-- ----------------------------
CREATE TRIGGER "LICHANGLIN"."T_CM_AIRPORT_TRIGGER" BEFORE INSERT ON "LICHANGLIN"."T_CM_AIRPORT" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW 
BEGIN
  select SEQ_CM_AIRPORT.Nextval into :NEW.ID from dual;
END;
/
