/*
 Navicat Premium Data Transfer

 Source Server         : sst-cloud
 Source Server Type    : Oracle
 Source Server Version : 120200
 Source Host           : szora1.sstparts.com:1521
 Source Schema         : SKYSTAR

 Target Server Type    : Oracle
 Target Server Version : 120200
 File Encoding         : 65001

 Date: 17/09/2019 17:18:37
*/


-- ----------------------------
-- Table structure for CUSTOMER_RAW_TEST
-- ----------------------------
DROP TABLE "SKYSTAR"."CUSTOMER_RAW_TEST";
CREATE TABLE "SKYSTAR"."CUSTOMER_RAW_TEST" (
  "ID" NUMBER(20) VISIBLE NOT NULL ,
  "DATA" CLOB VISIBLE ,
  "SOURCE_TYPE_ID" NUMBER(20) VISIBLE ,
  "STATUS" NUMBER(3) VISIBLE DEFAULT 211      ,
  "CREATE_BY" NUMBER(20) VISIBLE ,
  "CREATE_DATE" DATE VISIBLE ,
  "UPDATE_BY" NUMBER(20) VISIBLE ,
  "UPDATE_DATE" DATE VISIBLE ,
  "DEL_FLAG" NUMBER(1) VISIBLE DEFAULT 0    ,
  "GOOGLE_FLAG" NUMBER VISIBLE ,
  "GOOGLE_ADDRESS" CLOB VISIBLE ,
  "PROCESS_FLAG" NUMBER VISIBLE 
)
TABLESPACE "SKYSTAR"
LOGGING
NOCOMPRESS
PCTFREE 10
INITRANS 1
STORAGE (
  INITIAL 65536 
  NEXT 1048576 
  MINEXTENTS 1
  MAXEXTENTS 2147483645
  BUFFER_POOL DEFAULT
)
PARALLEL 1
NOCACHE
DISABLE ROW MOVEMENT
;
COMMENT ON COLUMN "SKYSTAR"."CUSTOMER_RAW_TEST"."SOURCE_TYPE_ID" IS 'Sys_Dict id';

-- ----------------------------
-- Records of CUSTOMER_RAW_TEST
-- ----------------------------
INSERT INTO "SKYSTAR"."CUSTOMER_RAW_TEST" VALUES ('1', '{"generalInfo":{"address":[{"country":5100,"countryName":"Test Country A","state":5110,"stateName":"Test State AA","cityTown":5111,"cityTownName":"Test City AAA"}]}}', '1', '213', '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '0', NULL, NULL, NULL);
INSERT INTO "SKYSTAR"."CUSTOMER_RAW_TEST" VALUES ('3', '{"generalInfo":{"address":[{"country":5100,"countryName":"Test Country A","state":5110,"stateName":"Test State AA","cityTown":5111,"cityTownName":"Test City AAA"}]}}', '1', '213', '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '0', NULL, NULL, NULL);
INSERT INTO "SKYSTAR"."CUSTOMER_RAW_TEST" VALUES ('4', '{"generalInfo":{"address":[{"country":5100,"countryName":"Test Country A","state":5110,"stateName":"Test State AA","cityTown":5111,"cityTownName":"Test City AAA"}]}}', '1', '213', '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '0', NULL, NULL, NULL);
INSERT INTO "SKYSTAR"."CUSTOMER_RAW_TEST" VALUES ('2', '{"generalInfo":{"address":[{"country":5100,"countryName":"Test Country A","state":5110,"stateName":"Test State AA","cityTown":5111,"cityTownName":"Test City AAA"}]}}', '1', '213', '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '1435', TO_DATE('2019-09-16 15:36:37', 'SYYYY-MM-DD HH24:MI:SS'), '0', NULL, NULL, NULL);
COMMIT;

-- ----------------------------
-- Checks structure for table CUSTOMER_RAW_TEST
-- ----------------------------
ALTER TABLE "SKYSTAR"."CUSTOMER_RAW_TEST" ADD CONSTRAINT "SYS_C0039230" CHECK ("ID" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "SKYSTAR"."CUSTOMER_RAW_TEST" ADD CONSTRAINT "SYS_C0039231" CHECK (DATA IS JSON) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "SKYSTAR"."CUSTOMER_RAW_TEST" ADD CONSTRAINT "SYS_C0039232" CHECK ("ID" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;
ALTER TABLE "SKYSTAR"."CUSTOMER_RAW_TEST" ADD CONSTRAINT "SYS_C0039233" CHECK ("ID" IS NOT NULL) NOT DEFERRABLE INITIALLY IMMEDIATE NORELY VALIDATE;

-- ----------------------------
-- Triggers structure for table CUSTOMER_RAW_TEST
-- ----------------------------
CREATE TRIGGER "SKYSTAR"."COUNT_COLLECTED_QTY" AFTER INSERT ON "SKYSTAR"."CUSTOMER_RAW_TEST" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW 
BEGIN
		UPDATE GLOBAL_LOCATION_TEST SET COLLECTED_QTY = COLLECTED_QTY + 1 
END;
/
COMMIT;
