TRUNCATE TABLE TB_CATE_GOODS;

INSERT INTO TB_CATE_GOODS
SELECT 0          AS BRAND_GROUP_NO
     , IC.CATE_NO
     , G.GOODS_CD
     , 100        AS DISP_ORD
     , 0          AS REG_NO
     , NOW()      AS REG_DT
FROM   TB_GOODS G
     , TB_ITEMKIND_CATE IC
WHERE  G.ITEMKIND_CD = IC.ITEMKIND_CD
AND    NOT EXISTS (SELECT 1
                   FROM   TB_CATE_GOODS
                   WHERE  BRAND_GROUP_NO = 0
                   AND    CATE_NO = IC.CATE_NO
                   AND    GOODS_CD = G.GOODS_CD
                  )
;

COMMIT;

SELECT * FROM TB_CATE_GOODS;
