Sep 9, 2012

aaa package required for Generic_task view.sql






How to set Org_id Context for particular Operating Unit: 

begin
dbms_application_info.set_client_info('458');
end;

-- We are trying to get rows from a xxxx_generic view:

-- The below will return 0 rows

select *
from PA_STATUS_TASK_GENERIC_V

-- As you know this view is made of other views (and table) 
          pa_tasks t,
          pa_status_task_bgt_cost_high_v c,
          pa_status_task_bgt_rev_high_v r,
          pa_status_task_act_v a,
          pa_status_task_cmt_v m
         
--  I tracked one of these down to the base table to find where it fails.
-- It looks like you will need to incorporate a package in the project-wb
-- from to get this to work. See the following:

-- Package:   pa_status.

pa_status
-- The views reference functions in this package.
-- You will need to use this package with parameters.

-- You can see an example by following the below:

-- If you run the following you WILL rows.
-- That means it is failing on the ohter view(s)
select * from pa_tasks

-- I researched the pa_status_task_bgt_cost_high_v view
-- If you run the following you will NOT get rows.  
select * from   pa_status_task_bgt_cost_high_v

-- That view is made from the following view.
-- If you run the following you will NOT get rows.
select * from   pa_status_task_bgt_cost_low_v

-- The above  view (pa_status_task_bgt_cost_low_v) is created using base tables.
-- The following is the SELECT statement used in the view pa_status_task_bgt_cost_low_v
-- I modified the below select statement by commenting lines that reference the package-variable
-- and replaced with project_ID 2255
-- As you can see it will return rows.
-- NOTE: the reference to pa_status.xxxxxx
-- You will need to include this package in the workbench from

SELECT pah.project_id, pah.task_id, pab.budget_type_code,
          NVL (pab.base_raw_cost_itd, 0), NVL (pab.base_raw_cost_ytd, 0),
          NVL (pab.base_raw_cost_pp, 0), NVL (pab.base_raw_cost_ptd, 0),
          NVL (pab.base_burdened_cost_itd, 0),
          NVL (pab.base_burdened_cost_ytd, 0),
          NVL (pab.base_burdened_cost_pp, 0),
          NVL (pab.base_burdened_cost_ptd, 0), NVL (pab.orig_raw_cost_itd, 0),
          NVL (pab.orig_raw_cost_ytd, 0), NVL (pab.orig_raw_cost_pp, 0),
          NVL (pab.orig_raw_cost_ptd, 0), NVL (pab.orig_burdened_cost_itd, 0),
          NVL (pab.orig_burdened_cost_ytd, 0),
          NVL (pab.orig_burdened_cost_pp, 0),
          NVL (pab.orig_burdened_cost_ptd, 0),
          NVL (pab.orig_labor_hours_itd, 0),
          NVL (pab.orig_labor_hours_ytd, 0), NVL (pab.orig_labor_hours_pp, 0),
          NVL (pab.orig_labor_hours_ptd, 0),
          NVL (pab.base_labor_hours_itd, 0),
          NVL (pab.base_labor_hours_ytd, 0), NVL (pab.base_labor_hours_pp, 0),
          NVL (pab.base_labor_hours_ptd, 0), NVL (pab.base_raw_cost_tot, 0),
          NVL (pab.base_burdened_cost_tot, 0), NVL (pab.orig_raw_cost_tot, 0),
          NVL (pab.orig_burdened_cost_tot, 0),
          NVL (pab.orig_labor_hours_tot, 0),
          NVL (pab.base_labor_hours_tot, 0)
     FROM pa_project_accum_headers pah, pa_project_accum_budgets pab
    WHERE pah.task_id > 0
      AND pah.project_id = 2255 --pa_status.getprojid
      AND pah.resource_list_id = 0
      AND pah.project_accum_id = pab.project_accum_id
      -- AND pab.budget_type_code = pa_status.getcostbgtcode
   UNION
   SELECT t.project_id, t.task_id, NULL --bt.budget_type_code
   , 0, 0, 0, 0, 0, 0, 0,
          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     FROM pa_tasks t, pa_budget_types bt
    WHERE --bt.budget_type_code = pa_status.getcostbgtcode
      --AND
      t.project_id = 2255  --pa_status.getprojid


No comments:

OraApps Search

Custom Search

Search This Blog