         , DLGN_RULE_TMPL_ID VARCHAR2(40)
         , VER_NBR NUMBER(8) default 0
         , OBJ_ID VARCHAR2(36) NOT NULL
-
+    
     , CONSTRAINT KREW_RULE_TMPL_TC0 UNIQUE (OBJ_ID)
     , CONSTRAINT KREW_RULE_TMPL_TI1 UNIQUE (NM)
 )

    ADD CONSTRAINT KREW_DOC_HDR_EXT_TP1
PRIMARY KEY (DOC_HDR_EXT_ID)
/
CREATE INDEX KREW_DOC_HDR_EXT_TI1
  ON KREW_DOC_HDR_EXT_T
  (KEY_CD, VAL)
/
CREATE INDEX KREW_DOC_HDR_EXT_TI2
  ON KREW_DOC_HDR_EXT_T
  (DOC_HDR_ID)
/
CREATE INDEX KREW_DOC_HDR_EXT_TI3
  ON KREW_DOC_HDR_EXT_T
  (VAL)
/
INSERT INTO KREW_DOC_HDR_EXT_T
(DOC_HDR_EXT_ID, DOC_HDR_ID, KEY_CD, VAL)
SELECT
CAST(DOC_HDR_EXT_ID as VARCHAR2(40)), DOC_HDR_ID, KEY_CD, VAL
FROM TEMP_KREW_DOC_HDR_EXT_T
/

-----------------------------------------------------------------------------
-- KREW_RULE_TMPL_ATTR_T
-----------------------------------------------------------------------------
ALTER TABLE KREW_RULE_TMPL_ATTR_T DROP CONSTRAINT KREW_RULE_TMPL_ATTR_TP1
/
DROP INDEX KREW_RULE_TMPL_ATTR_TI1
/
DROP INDEX KREW_RULE_TMPL_ATTR_TI2
/
ALTER TABLE KREW_RULE_TMPL_ATTR_T RENAME TO TEMP_KREW_RULE_TMPL_ATTR_T
/
