CREATE TABLE "POLYGON_SURVEY_CORE"
(
  "_URI" character varying(80) NOT NULL,
  "_CREATOR_URI_USER" character varying(80) NOT NULL,
  "_CREATION_DATE" timestamp without time zone NOT NULL,
  "_LAST_UPDATE_URI_USER" character varying(80),
  "_LAST_UPDATE_DATE" timestamp without time zone NOT NULL,
  "_MODEL_VERSION" integer,
  "_UI_VERSION" integer,
  "_IS_COMPLETE" boolean,
  "_SUBMISSION_DATE" timestamp without time zone,
  "_MARKED_AS_COMPLETE_DATE" timestamp without time zone,
  "RUNGTRONG2_CAPTUOI" character varying(255),
  "PFES" character varying(255),
  "KHTHAC_THGIANKHTHAC" timestamp without time zone,
  "HIENTRANGTANG" character varying(255),
  "LOAIDATLR" character varying(255),
  "THOIHANSD" timestamp without time zone,
  "TINHTRANGRUNG" character varying(255),
  "RUNGTRONG_TINHTRANGTRUNG" character varying(255),
  "QH_QUYHOACH" character varying(255),
  "NGUONGOCR" character varying(255),
  "KIEUQL" character varying(255),
  "NGNHKH_TRLTNKH" integer,
  "HT1_DTICHTN" numeric(38,10),
  "LS_THGIANLS" timestamp without time zone,
  "HUYEN" character varying(255),
  "NGNHKH_DTICHKHAC" numeric(38,10),
  "TRONGRUNG_VANLOAICAY1" character varying(255),
  "TRONGRUNG2_DTICHTRONG" numeric(38,10),
  "HT3_DTICHDT" numeric(38,10),
  "LOAICAYTRONG" character varying(255),
  "KHTHAC_KIEUKHAITHAC" character varying(255),
  "HT1_THTINTN" character varying(255),
  "NGNHKH_TRLGOKH" numeric(38,10),
  "LS_DTICHLS" numeric(38,10),
  "STORE_SHAPES" character varying(10000),
  "TINHTRANGSD" character varying(255),
  "TDG_THGIANTD" timestamp without time zone,
  "TRCHAP" character varying(255),
  "LOAIDTR" character varying(255),
  "KBAOVE_MAKHOAN" integer,
  "BALOAIRUNG" character varying(255),
  "NAME" character varying(255),
  "QH_VITRITHUDAT" character varying(255),
  "DOITUONGSD" character varying(255),
  "RUNGTRONG2_NAMTRONG" timestamp without time zone,
  "TKK_THUADAT" character varying(255),
  "TKK_TIEUKHU" character varying(255),
  "CMD_THGIANCD" timestamp without time zone,
  "RUNGTRONG_VANLOAICAY" character varying(255),
  "CMD_TRLTNCD" integer,
  "HIENTRANGGIAMRT" character varying(255),
  "KHTHAC_TRLUONGGOKHTHAC" numeric(38,10),
  "TRONGRUNG2_LOAICAYTRONGR" character varying(255),
  "KHTHAC_TRLTRNKHTHAC" integer,
  "LOAIDATLR2" character varying(255),
  "NGNHANBD" character varying(255),
  "KHTHAC_DTICHKHTHAC" numeric(38,10),
  "TINH" character varying(255),
  "CMD_DTICHCD" numeric(38,10),
  "TRC_TENTRC" character varying(255),
  "CMD_TRLGOCD" numeric(38,10),
  "HT1_HIENTRANGTN" character varying(255),
  "HT3_HIENTRANGDT" character varying(255),
  "META_INSTANCE_ID" character varying(255),
  "CHUCNANG" character varying(255),
  "TDG_TRLUONGGOTD" numeric(38,10),
  "TDG_LOAITD" character varying(255),
  "TKK_TOBANDO" character varying(255),
  "KBAOVE_TENKHOAN" character varying(255),
  "HIENTRANGGIAM" character varying(255),
  "TRONGRUNG_LOAIRT" character varying(255),
  "THONBAN" character varying(255),
  "TDG_DTICHTD" numeric(38,10),
  "TRONGRUNG2_MATDO" integer,
  "CHURUNG_MACHURUNG" integer,
  "RUNGTRONG_NGUONGOCRUNGTR" character varying(255),
  "DKLAPDIA" character varying(255),
  "NGNHKH_THGIANKHAC" timestamp without time zone,
  "TODAY" timestamp without time zone,
  "KBVE" character varying(255),
  "LS_LAMSINH" character varying(255),
  "RUNGTRONG2_NTR" character varying(255),
  "TRONGRUNG_TTRT" character varying(255),
  "XA" character varying(255),
  "CMD_MUCDICH" character varying(255),
  "HT2_THTINRT" character varying(255),
  "TKK_KHOANH" character varying(255),
  "KIEUBD" character varying(255),
  "RUNGTRONG_LOAIDATLR1" character varying(255),
  "TDG_TLRTRNTD" integer,
  "TKK_LO" character varying(255),
  "CHURUNG_TENCHURUNG" character varying(255),
  "TRONGRUNG2_THGIANTRONG" timestamp without time zone,
  "RUNGTRONG2_NAMKT" character varying(255),
  "TRC_MATRC" integer,
  "HT2_HIENTRANGRT" character varying(255),
  "HT3_THTINDT" character varying(255),
  "HT2_DTICHRT" numeric(38,10),
  "BIENPHAPLS" character varying(255),
  "NGNHKH_NGNHANKH" character varying(255),
  "KIEUSD" character varying(255),
  CONSTRAINT "POLYGON_SURVEY_CORE__URI_key" UNIQUE ("_URI")
)
WITH (
  OIDS=FALSE
);
ALTER TABLE "POLYGON_SURVEY_CORE"
  OWNER TO thanhnv;

-- Index: "POLYGON_SURVEY_CORE_lud"

-- DROP INDEX "POLYGON_SURVEY_CORE_lud";

CREATE INDEX "POLYGON_SURVEY_CORE_lud"
  ON "POLYGON_SURVEY_CORE"
  USING btree
  ("_LAST_UPDATE_DATE");

-- Index: "POLYGON_SURVEY_CORE_macd"

-- DROP INDEX "POLYGON_SURVEY_CORE_macd";

CREATE INDEX "POLYGON_SURVEY_CORE_macd"
  ON "POLYGON_SURVEY_CORE"
  USING btree
  ("_MARKED_AS_COMPLETE_DATE");


-- Trigger: luu_trigger on "POLYGON_SURVEY_CORE"

-- DROP TRIGGER luu_trigger ON "POLYGON_SURVEY_CORE";

CREATE TRIGGER luu_trigger
  AFTER INSERT
  ON "POLYGON_SURVEY_CORE"
  FOR EACH ROW
  EXECUTE PROCEDURE save_data();