• SQL语句在OLAP的妙用(多维分析与指标计算)


    ================================================================================

    BI传统实现原理:

    1.涉及维度管理(唯一路径,一张网)

    2.依据分析维度要求,创建临时表,计算数据,创建缓存表,把计算的结果存储到缓存表中,删除临时表

    3.保存生成临时表的SQL语句、缓存计算的SQL语句、查询缓存表的SQL语句

    4.完成

    总结:维度建模-打包计算数据-显示

    ================================================================================

    SELECT
    A0.COMP_CODE,
    1281 AS ITEMS_CODE,
    3009 AS CLASS_CODE,
    A0.FINT_YEAR,
    A0.FINT_MONTH,
    (A0.ITEM_VALUES - A1.ITEM_VALUES) + A2.ITEM_VALUES - A3.ITEM_VALUES - A4.ITEM_VALUES AS
    ITEM_VALUES,
    A0.PERIOD_TYPE
    FROM
    (
    SELECT
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE,
    SUM(ITEM_VALUES) AS ITEM_VALUES
    FROM
    BI_CUSTOM_ITEMS_DATA
    WHERE
    FINT_YEAR = '2013'
    AND FINT_MONTH >= '01'
    AND FINT_MONTH <= 12
    AND COMP_CODE = '01'
    AND ITEMS_CODE IN ('1210')
    GROUP BY
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE
    ) a0,
    (
    SELECT
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE,
    SUM(ITEM_VALUES) AS ITEM_VALUES
    FROM
    BI_CUSTOM_ITEMS_DATA
    WHERE
    FINT_YEAR = '2013'
    AND FINT_MONTH >= '01'
    AND FINT_MONTH <= '12'
    AND COMP_CODE = '01'
    AND ITEMS_CODE IN ('1211')
    GROUP BY
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE
    ) a1,
    (
    SELECT
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE,
    SUM(ITEM_VALUES) AS ITEM_VALUES
    FROM
    BI_CUSTOM_ITEMS_DATA
    WHERE
    FINT_YEAR = '2013'
    AND FINT_MONTH >= '01'
    AND FINT_MONTH <= '12'
    AND COMP_CODE = '01'
    AND ITEMS_CODE IN ('1212')
    GROUP BY
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE
    ) a2,
    (
    SELECT
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE,
    SUM(ITEM_VALUES) AS ITEM_VALUES
    FROM
    BI_CUSTOM_ITEMS_DATA
    WHERE
    FINT_YEAR = 2013
    AND FINT_MONTH >= 01
    AND FINT_MONTH <= 12
    AND COMP_CODE = 01
    AND ITEMS_CODE IN (1213)
    GROUP BY
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE
    ) a3,
    (
    SELECT
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE,
    SUM(ITEM_VALUES) AS ITEM_VALUES
    FROM
    BI_CUSTOM_ITEMS_DATA
    WHERE
    FINT_YEAR = 2013
    AND FINT_MONTH >= 01
    AND FINT_MONTH <= 12
    AND COMP_CODE = 01
    AND ITEMS_CODE IN (1214)
    GROUP BY
    COMP_CODE,
    FINT_YEAR,
    FINT_MONTH,
    PERIOD_TYPE,
    ITEMS_CODE,
    CLASS_CODE
    ) a4
    WHERE
    A0.COMP_CODE = A1.COMP_CODE
    AND A0.FINT_YEAR = A1.FINT_YEAR
    AND A0.FINT_MONTH = A1.FINT_MONTH
    AND A0.PERIOD_TYPE = A1.PERIOD_TYPE
    AND A1.COMP_CODE = A2.COMP_CODE
    AND A1.FINT_YEAR = A2.FINT_YEAR
    AND A1.FINT_MONTH = A2.FINT_MONTH
    AND A1.PERIOD_TYPE = A2.PERIOD_TYPE
    AND A2.COMP_CODE = A3.COMP_CODE
    AND A2.FINT_YEAR = A3.FINT_YEAR
    AND A2.FINT_MONTH = A3.FINT_MONTH
    AND A2.PERIOD_TYPE = A3.PERIOD_TYPE
    AND A3.COMP_CODE = A4.COMP_CODE
    AND A3.FINT_YEAR = A4.FINT_YEAR
    AND A3.FINT_MONTH = A4.FINT_MONTH
    AND A3.PERIOD_TYPE = A4.PERIOD_TYPE

    ==========================================

    /************************************************************
    * Code formatted by SoftTree SQL Assistant ?v6.5.278
    * Time: 2014/12/14 10:54:54
    ************************************************************/

    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'per_income' AS COLUMN_CODE,
    per_income AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'attr_rate' AS COLUMN_CODE,
    attr_rate AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'ryjf_cost' AS COLUMN_CODE,
    ryjf_amount AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'gdzc_cost' AS COLUMN_CODE,
    gdzc_amount AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'per_cost' AS COLUMN_CODE,
    per_cost AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'wscl_cost' AS COLUMN_CODE,
    wscl_amount AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'wxzc_cost' AS COLUMN_CODE,
    wxzc_amount AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'qtfy_cost' AS COLUMN_CODE,
    qtfy_amount AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'fxjj_cost' AS COLUMN_CODE,
    fxjj_amount AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;DROP TABLE temp_2642DIM_21;/**下一段SQL**/
    CREATE TABLE temp_2642DIM_2193
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_89
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2070
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2282
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2166
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_2086
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    CREATE TABLE temp_2642DIM_21
    (
    DIM_2193_fint_year VARCHAR(4000),
    DIM_2193_fint_month VARCHAR(4000),
    DIM_2193_COLUMN_CODE VARCHAR(4000),
    DIM_2193_comp_code VARCHAR(4000),
    DIM_2193_charge_detail_code VARCHAR(4000),
    DIM_2193_charge_kind_code VARCHAR(4000),
    DIM_2193_dept_code VARCHAR(4000),
    DIM_89_COLUMN_DISPLAY VARCHAR(4000),
    DIM_89_COLUMN_CODE VARCHAR(4000),
    DIM_2070_charge_detail_name VARCHAR(4000),
    DIM_2070_charge_detail_code VARCHAR(4000),
    DIM_2070_comp_code VARCHAR(4000),
    DIM_2282_charge_kind_name VARCHAR(4000),
    DIM_2282_charge_kind_code VARCHAR(4000),
    DIM_2166_comp_code VARCHAR(4000),
    DIM_2166_cost_dept_code VARCHAR(4000),
    DIM_2166_fint_year VARCHAR(4000),
    DIM_2166_app_dept_type_code VARCHAR(4000),
    DIM_2086_app_dept_type_name VARCHAR(4000),
    DIM_2086_app_dept_type_code VARCHAR(4000),
    DIM_21_comp_name VARCHAR(4000),
    DIM_21_comp_code VARCHAR(4000),
    DIM_2193_COLUMN_DATA_vh NUMBER(18, 6)
    );
    INSERT INTO temp_2642DIM_2193
    SELECT DIM_2193.fint_year AS DIM_2193_fint_year,
    DIM_2193.fint_month AS DIM_2193_fint_month,
    DIM_2193.COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.comp_code AS DIM_2193_comp_code,
    DIM_2193.charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.dept_code AS DIM_2193_dept_code,
    SUM(DIM_2193.COLUMN_DATA) AS DIM_2193_COLUMN_DATA_vh
    FROM (
    SELECT *
    FROM (
    SELECT DATA_WK_DEPT_DIRECT_COST.*,
    'work_load' AS COLUMN_CODE,
    work_load AS COLUMN_DATA
    FROM DATA_WK_DEPT_DIRECT_COST
    ) T
    ) DIM_2193
    WHERE DIM_2193.fint_year = '2013'
    AND DIM_2193.fint_month = '12'
    GROUP BY
    DIM_2193.fint_year,
    DIM_2193.fint_month,
    DIM_2193.COLUMN_CODE,
    DIM_2193.comp_code,
    DIM_2193.charge_detail_code,
    DIM_2193.charge_kind_code,
    DIM_2193.dept_code;
    INSERT INTO temp_2642DIM_89
    SELECT DIM_2193.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE AS DIM_89_COLUMN_CODE,
    SUM(DIM_2193.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2193 DIM_2193
    INNER JOIN (
    SELECT rep_dimension_multi_item.*
    FROM rep_dimension_multi_item rep_dimension_multi_item
    ) DIM_89
    ON (
    1 = 1
    AND DIM_89.COLUMN_CODE = DIM_2193.DIM_2193_COLUMN_CODE
    AND DIM_89.DIM_ID = 2193
    )
    GROUP BY
    DIM_2193.DIM_2193_fint_year,
    DIM_2193.DIM_2193_fint_month,
    DIM_2193.DIM_2193_COLUMN_CODE,
    DIM_2193.DIM_2193_comp_code,
    DIM_2193.DIM_2193_charge_detail_code,
    DIM_2193.DIM_2193_charge_kind_code,
    DIM_2193.DIM_2193_dept_code,
    DIM_89.COLUMN_DISPLAY,
    DIM_89.COLUMN_CODE;
    INSERT INTO temp_2642DIM_2070
    SELECT DIM_89.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.comp_code AS DIM_2070_comp_code,
    SUM(DIM_89.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_89 DIM_89
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL.*
    FROM DICT_CHARGE_DETAIL DICT_CHARGE_DETAIL
    ) DIM_2070
    ON (
    1 = 1
    AND DIM_2070.comp_code = DIM_89.DIM_2193_comp_code
    AND DIM_2070.charge_detail_code = DIM_89.DIM_2193_charge_detail_code
    )
    GROUP BY
    DIM_89.DIM_2193_fint_year,
    DIM_89.DIM_2193_fint_month,
    DIM_89.DIM_2193_COLUMN_CODE,
    DIM_89.DIM_2193_comp_code,
    DIM_89.DIM_2193_charge_detail_code,
    DIM_89.DIM_2193_charge_kind_code,
    DIM_89.DIM_2193_dept_code,
    DIM_89.DIM_89_COLUMN_DISPLAY,
    DIM_89.DIM_89_COLUMN_CODE,
    DIM_2070.charge_detail_name,
    DIM_2070.charge_detail_code,
    DIM_2070.comp_code;
    INSERT INTO temp_2642DIM_2282
    SELECT DIM_2070.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.charge_kind_code AS DIM_2282_charge_kind_code,
    SUM(DIM_2070.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2070 DIM_2070
    INNER JOIN (
    SELECT DICT_CHARGE_DETAIL_KIND.*
    FROM DICT_CHARGE_DETAIL_KIND DICT_CHARGE_DETAIL_KIND
    ) DIM_2282
    ON (
    1 = 1
    AND DIM_2282.charge_kind_code = DIM_2070.DIM_2193_charge_kind_code
    )
    GROUP BY
    DIM_2070.DIM_2193_fint_year,
    DIM_2070.DIM_2193_fint_month,
    DIM_2070.DIM_2193_COLUMN_CODE,
    DIM_2070.DIM_2193_comp_code,
    DIM_2070.DIM_2193_charge_detail_code,
    DIM_2070.DIM_2193_charge_kind_code,
    DIM_2070.DIM_2193_dept_code,
    DIM_2070.DIM_89_COLUMN_DISPLAY,
    DIM_2070.DIM_89_COLUMN_CODE,
    DIM_2070.DIM_2070_charge_detail_name,
    DIM_2070.DIM_2070_charge_detail_code,
    DIM_2070.DIM_2070_comp_code,
    DIM_2282.charge_kind_name,
    DIM_2282.charge_kind_code;
    INSERT INTO temp_2642DIM_2166
    SELECT DIM_2282.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.comp_code AS DIM_2166_comp_code,
    DIM_2166.cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.fint_year AS DIM_2166_fint_year,
    DIM_2166.app_dept_type_code AS DIM_2166_app_dept_type_code,
    SUM(DIM_2282.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2282 DIM_2282
    INNER JOIN (
    SELECT BUSI_WK_DEPT.*
    FROM BUSI_WK_DEPT BUSI_WK_DEPT
    ) DIM_2166
    ON (
    1 = 1
    AND DIM_2166.comp_code = DIM_2282.DIM_2193_comp_code
    AND DIM_2166.cost_dept_code = DIM_2282.DIM_2193_dept_code
    AND DIM_2166.fint_year = DIM_2282.DIM_2193_fint_year
    )
    GROUP BY
    DIM_2282.DIM_2193_fint_year,
    DIM_2282.DIM_2193_fint_month,
    DIM_2282.DIM_2193_COLUMN_CODE,
    DIM_2282.DIM_2193_comp_code,
    DIM_2282.DIM_2193_charge_detail_code,
    DIM_2282.DIM_2193_charge_kind_code,
    DIM_2282.DIM_2193_dept_code,
    DIM_2282.DIM_89_COLUMN_DISPLAY,
    DIM_2282.DIM_89_COLUMN_CODE,
    DIM_2282.DIM_2070_charge_detail_name,
    DIM_2282.DIM_2070_charge_detail_code,
    DIM_2282.DIM_2070_comp_code,
    DIM_2282.DIM_2282_charge_kind_name,
    DIM_2282.DIM_2282_charge_kind_code,
    DIM_2166.comp_code,
    DIM_2166.cost_dept_code,
    DIM_2166.fint_year,
    DIM_2166.app_dept_type_code;
    INSERT INTO temp_2642DIM_2086
    SELECT DIM_2166.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.app_dept_type_code AS DIM_2086_app_dept_type_code,
    SUM(DIM_2166.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2166 DIM_2166
    INNER JOIN (
    SELECT VIEW_DICT_COST_APP_DEPT_TYPE.*
    FROM VIEW_DICT_COST_APP_DEPT_TYPE VIEW_DICT_COST_APP_DEPT_TYPE
    ) DIM_2086
    ON (
    1 = 1
    AND DIM_2086.app_dept_type_code = DIM_2166.DIM_2166_app_dept_type_code
    )
    GROUP BY
    DIM_2166.DIM_2193_fint_year,
    DIM_2166.DIM_2193_fint_month,
    DIM_2166.DIM_2193_COLUMN_CODE,
    DIM_2166.DIM_2193_comp_code,
    DIM_2166.DIM_2193_charge_detail_code,
    DIM_2166.DIM_2193_charge_kind_code,
    DIM_2166.DIM_2193_dept_code,
    DIM_2166.DIM_89_COLUMN_DISPLAY,
    DIM_2166.DIM_89_COLUMN_CODE,
    DIM_2166.DIM_2070_charge_detail_name,
    DIM_2166.DIM_2070_charge_detail_code,
    DIM_2166.DIM_2070_comp_code,
    DIM_2166.DIM_2282_charge_kind_name,
    DIM_2166.DIM_2282_charge_kind_code,
    DIM_2166.DIM_2166_comp_code,
    DIM_2166.DIM_2166_cost_dept_code,
    DIM_2166.DIM_2166_fint_year,
    DIM_2166.DIM_2166_app_dept_type_code,
    DIM_2086.app_dept_type_name,
    DIM_2086.app_dept_type_code;
    INSERT INTO temp_2642DIM_21
    SELECT DIM_2086.DIM_2193_fint_year AS DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month AS DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE AS DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code AS DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code AS DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code AS DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code AS DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY AS DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE AS DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name AS DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code AS DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code AS DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name AS DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code AS DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code AS DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code AS DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year AS DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code AS DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name AS DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code AS DIM_2086_app_dept_type_code,
    DIM_21.comp_name AS DIM_21_comp_name,
    DIM_21.comp_code AS DIM_21_comp_code,
    SUM(DIM_2086.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_COLUMN_DATA_vh
    FROM temp_2642DIM_2086 DIM_2086
    INNER JOIN (
    SELECT SYS_COMPANY.*
    FROM SYS_COMPANY SYS_COMPANY
    ) DIM_21
    ON (1 = 1 AND DIM_21.comp_code = DIM_2086.DIM_2193_comp_code)
    WHERE DIM_21.comp_code IN ('01')
    GROUP BY
    DIM_2086.DIM_2193_fint_year,
    DIM_2086.DIM_2193_fint_month,
    DIM_2086.DIM_2193_COLUMN_CODE,
    DIM_2086.DIM_2193_comp_code,
    DIM_2086.DIM_2193_charge_detail_code,
    DIM_2086.DIM_2193_charge_kind_code,
    DIM_2086.DIM_2193_dept_code,
    DIM_2086.DIM_89_COLUMN_DISPLAY,
    DIM_2086.DIM_89_COLUMN_CODE,
    DIM_2086.DIM_2070_charge_detail_name,
    DIM_2086.DIM_2070_charge_detail_code,
    DIM_2086.DIM_2070_comp_code,
    DIM_2086.DIM_2282_charge_kind_name,
    DIM_2086.DIM_2282_charge_kind_code,
    DIM_2086.DIM_2166_comp_code,
    DIM_2086.DIM_2166_cost_dept_code,
    DIM_2086.DIM_2166_fint_year,
    DIM_2086.DIM_2166_app_dept_type_code,
    DIM_2086.DIM_2086_app_dept_type_name,
    DIM_2086.DIM_2086_app_dept_type_code,
    DIM_21.comp_name,
    DIM_21.comp_code;
    SELECT DIM_21.DIM_89_COLUMN_CODE AS DIM_89_CODE,
    MAX(DIM_21.DIM_89_COLUMN_DISPLAY) AS DIM_89_DISPLAY,
    DIM_21.DIM_2070_charge_detail_code AS DIM_2070_CODE,
    MAX(DIM_21.DIM_2070_charge_detail_name) AS DIM_2070_DISPLAY,
    DIM_21.DIM_2282_charge_kind_code AS DIM_2282_CODE,
    MAX(DIM_21.DIM_2282_charge_kind_name) AS DIM_2282_DISPLAY,
    DIM_21.DIM_2086_app_dept_type_code AS DIM_2086_CODE,
    MAX(DIM_21.DIM_2086_app_dept_type_name) AS DIM_2086_DISPLAY,
    '201312' AS DIM_DATE_CODE,
    'YEAR_MONTH' AS DIM_DATE_LEVEL,
    DIM_21.DIM_21_comp_code AS DIM_21_CODE,
    MAX(DIM_21.DIM_21_comp_name) AS DIM_21_DISPLAY,
    SUM(DIM_21.DIM_2193_COLUMN_DATA_vh) AS DIM_2193_DATA
    FROM temp_2642DIM_21 DIM_21
    GROUP BY
    DIM_21.DIM_89_COLUMN_CODE,
    DIM_21.DIM_2070_charge_detail_code,
    DIM_21.DIM_2282_charge_kind_code,
    DIM_21.DIM_2086_app_dept_type_code,
    DIM_21.DIM_21_comp_code
    ORDER BY
    DIM_21.DIM_89_COLUMN_CODE ASC,
    DIM_21.DIM_2070_charge_detail_code ASC,
    DIM_21.DIM_2282_charge_kind_code ASC,
    DIM_21.DIM_2086_app_dept_type_code ASC,
    DIM_21.DIM_21_comp_code ASC;DROP TABLE temp_2642DIM_2193;DROP TABLE
    temp_2642DIM_89;DROP TABLE temp_2642DIM_2070;DROP TABLE temp_2642DIM_2282;DROP
    TABLE temp_2642DIM_2166;DROP TABLE temp_2642DIM_2086;

    ======================================================================================

  • 相关阅读:
    自动交互式脚本--expect
    如何搭建web服务器 使用Nginx搭建反向代理服务器
    linux安装yaf(ubuntu教程)
    如何使用Apache的ab工具进行网站性能测试
    网虚拟主机----云服务器
    handlebars Helper用法
    网络基础知识学习
    使用清华开源镜像安装tensorflow
    安卓开发笔记(二十五):ViewPager的简单介绍和使用
    轻松搞定表白女朋友:Android版APP (零基础也可前往Github免费下载软件)
  • 原文地址:https://www.cnblogs.com/gstsyyb/p/4077199.html
Copyright © 2020-2023  润新知