从多个表将数据加载到维表的PLSQL过程

时间:2019-01-01 00:09:03

标签: plsql loading dimension

我需要加载不同的costcenternum和要插入的seq_key。我编写了一个过程,但是这样做失败了,即使删除了无法运行的过程也是如此。

请帮助我更正此查询,以生成一个seq密钥,并将不同的费用编号生成除法表。

CREATE OR REPLACE 
PROCEDURE POPULATE_DIVISION_DIM AS
BEGIN
INSERT INTO DIVISION(
"COST_CENTER_KEY"
,"COST_CENTER_NUM"
,"COST_CENTER_DESC"
,"DIVISION_CODE"
,"DIVISION_DESC"
,"COMPANY_CODE"
,"INSERT_DT"
,"UPDATE_DT"
 ) 
(
 SELECT
    cc_sequence.nextval cost_center_key
    , distinct (pcaf.segment4) costcenter_num 
    ,ffvv.description costcenter_desc
    ,hoi.org_information9 division
    ,(SELECT description
                       FROM hr_lookups
                       WHERE lookup_type = 'CAT'
                       AND lookup_code = hoi.org_information9) 
         division_desc
    , ppg.segment1 company
    ,TRUNC(SYSDATE) insert_dt
    ,TRUNC(SYSDATE) update_dt
      FROM  
   hr_organization_information hoi
 , hr_all_organization_units haou
 , pay_cost_allocation_keyflex pcaf
 , fnd_flex_values_vl ffvv
 , per_all_assignments_f paaf
 , pay_people_groups ppg
 WHERE 1=1 
    AND paaf.people_group_id = ppg.people_group_id
    AND haou.cost_allocation_keyflex_id = 
     pcaf.cost_allocation_keyflex_id(+)
    AND pcaf.segment4 = ffvv.flex_value(+)
    AND (ffvv.FLEX_VALUE_SET_ID is null or ffvv.FLEX_VALUE_SET_ID=
           (SELECT FLEX_VALUE_SET_ID FROM FND_FLEX_VALUE_SETS WHERE 
       FLEX_VALUE_SET_NAME = 'ABCD'))
    AND ffvv.enabled_flag(+) = 'Y'
    AND haou.organization_id = hoi.organization_id
    AND hoi.org_information_context = 'XX'
      )
  ;

   COMMIT;
    END POPULATE_DIVISION_DIM;

0 个答案:

没有答案