--
-- Type: TABLE; Owner: TM_CZ; Name: CZ_DW_VERSION
--
 CREATE TABLE "TM_CZ"."CZ_DW_VERSION" 
  (	"DW_VERSION_ID" NUMBER(18,0) NOT NULL ENABLE, 
"VERSION_NAME" NVARCHAR2(200), 
"RELEASE_DATE" DATE, 
"CREATE_DATE" DATE, 
"CREATED_BY" NUMBER(18,0), 
"IS_CURRENT" CHAR(1 CHAR), 
 CONSTRAINT "CZ_DW_VERSION_PK" PRIMARY KEY ("DW_VERSION_ID")
 USING INDEX
 TABLESPACE "TRANSMART"  ENABLE
  ) SEGMENT CREATION IMMEDIATE
 TABLESPACE "TRANSMART" ;

--
-- Type: SEQUENCE; Owner: TM_CZ; Name: SEQ_CZ_DW_VERSION_ID
--
CREATE SEQUENCE  "TM_CZ"."SEQ_CZ_DW_VERSION_ID"  MINVALUE 1 MAXVALUE 999999999999999999999999 INCREMENT BY 1 START WITH 41 CACHE 2 NOORDER  NOCYCLE ;

--
-- Type: TRIGGER; Owner: TM_CZ; Name: TRG_CZ_DW_VERSION_ID
--
  CREATE OR REPLACE TRIGGER "TM_CZ"."TRG_CZ_DW_VERSION_ID" before insert on "CZ_DW_VERSION"    for each row 
begin     if inserting then       if :NEW."DW_VERSION_ID" is null then          select SEQ_CZ_DW_VERSION_ID.nextval into :NEW."DW_VERSION_ID" from dual;       end if;    end if; end;









/
ALTER TRIGGER "TM_CZ"."TRG_CZ_DW_VERSION_ID" ENABLE;
 
