SQL Query Having performance issues

I need help on rewriting this query, I am having performance issues with the way it is now. I create a temporary table and query against it. Any help will be appreciated. Thanks, Antonio
Here it is:
create global temporary table pr_php_elig_tmp
on commit preserve rows as
SELECT UNIQUE A.SAK_PROV, A.CDE_SERVICE_LOC, a.sak_short
FROM T_PR_PHP_ELIG A,
T_PR_TYPE C
WHERE C.SAK_PROV = A.SAK_PROV
AND C.CDE_SERVICE_LOC = A.CDE_SERVICE_LOC
AND C.CDE_PROV_TYPE not in ('01', '03', '08', '24', '27', '31')
AND A.SAK_PROV_PGM not in (11, 13)
AND A.DTE_END >= :il_current_date
AND A.DTE_EFFECTIVE <= :il_prev_18_months
AND NOT EXISTS (
SELECT 'X'
FROM T_PR_GRP_MBR T
WHERE T.SAK_PROV = A.SAK_PROV
AND T.CDE_SVC_LOC_MBR = A.CDE_SERVICE_LOC)
AND NOT EXISTS (
select a.sak_prov, a.cde_service_loc
from t_pmp_svc_loc d
where a.sak_prov = d.sak_prov
and a.cde_service_loc = d.cde_service_loc
and d.dte_end >= :il_current_date)
ORDER BY A.SAK_PROV, A.CDE_SERVICE_LOC;
select * from pr_php_elig_tmp
minus
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_dntl_dtl temp01
               WHERE temp01.sak_prov_perf = a.sak_prov
               and temp01.cde_svc_loc_perf = a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
               HAVING MAX(temp01.DTE_FIRST_SVC) >= :il_prev_18_months
               OR NVL(MAX(temp01.DTE_FIRST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_dntl_hdr temp02
               WHERE ( (temp02.prov_billing     = a.sak_prov
               and temp02.cde_service_loc = a.cde_service_loc)
               OR     (temp02.sak_prov_perf     = a.sak_prov
               and temp02.cde_perf_svc_loc = a.cde_service_loc)
               OR     (temp02.sak_prov_referring = a.sak_prov
               and temp02.cde_svc_loc_ref_1 = a.cde_service_loc)
               OR     (temp02.sak_prov_referring_2 = a.sak_prov
               and temp02.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
               HAVING MAX(temp02.DTE_FINAL)     >= :il_prev_18_months
               OR NVL(MAX(temp02.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phrm_hdr temp03
               WHERE ( (temp03.prov_billing     = a.sak_prov and
                    temp03.cde_service_loc = a.cde_service_loc)
               OR     (temp03.sak_prov_rendering = a.sak_prov and
                    temp03.cde_svc_loc_rend = a.cde_service_loc)
               OR     (temp03.sak_presc_prov = a.sak_prov and
                    temp03.cde_svc_loc_presc = a.cde_service_loc)
               OR     temp03.id_prov_prescrb = to_char(a.sak_prov) || a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
               HAVING     MAX(temp03.DTE_FINAL) >= :il_prev_18_months
               OR     NVL(MAX(temp03.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phys_dtl temp04
          WHERE ( (temp04.sak_prov_perf     = a.sak_prov
               and     temp04.cde_svc_loc_rend = a.cde_service_loc)
               OR (temp04.sak_prov_referring = a.sak_prov
               and     temp04.cde_svc_loc_ref_1 = a.cde_service_loc)
               OR (temp04.sak_prov_referring_2 = a.sak_prov
               and     temp04.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING     MAX(temp04.DTE_LAST_SVC)     >= :il_prev_18_months
               OR     NVL(MAX(temp04.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phys_hdr temp05
          WHERE ( (temp05.prov_billing     = a.sak_prov
               and     temp05.cde_service_loc     = a.cde_service_loc)
               OR (temp05.sak_prov_perf     = a.sak_prov
               and     temp05.cde_perf_svc_loc = a.cde_service_loc)
               OR (temp05.sak_prov_referring = a.sak_prov
               and     temp05.cde_svc_loc_ref_1 = a.cde_service_loc)
               OR (temp05.sak_prov_referring_2 = a.sak_prov
               and     temp05.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING     MAX(temp05.DTE_FINAL) >= :il_prev_18_months
               OR     NVL(MAX(temp05.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_ub92_dtl temp06
          WHERE ( (temp06.sak_pr_other     = a.sak_prov
               and     temp06.cde_scv_loc_other = a.cde_service_loc)
               OR (temp06.sak_pr_other_2     = a.sak_prov
               and     temp06.cde_svc_loc_other_2 = a.cde_service_loc)
               OR (temp06.sak_pr_attend     = a.sak_prov
               and     temp06.cde_svc_loc_attend = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING     MAX(temp06.DTE_LAST_SVC)     >= :il_prev_18_months
               OR     NVL(MAX(temp06.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_ub92_hdr temp07
          WHERE ( (temp07.prov_billing     = a.sak_prov
               and     temp07.cde_service_loc     = a.cde_service_loc)
          OR (temp07.sak_pr_facility     = a.sak_prov
               and     temp07.cde_svc_loc_fa     = a.cde_service_loc)
          OR (temp07.sak_pr_other     = a.sak_prov
               and     temp07.cde_svc_loc_other = a.cde_service_loc)
          OR (temp07.sak_pr_other_2     = a.sak_prov
               and     temp07.cde_svc_loc_other_2 = a.cde_service_loc)
          OR (temp07.sak_pr_attend     = a.sak_prov
               and     temp07.cde_svc_loc_attend = a.cde_service_loc)
          OR     temp07.id_prov_attend     = to_char(a.sak_prov) || a.cde_service_loc
          OR     temp07.id_prov_other     = to_char(a.sak_prov) || a.cde_service_loc
          OR     temp07.id_prov_other_2     = to_char(a.sak_prov) || a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp07.DTE_FINAL)     >= :il_prev_18_months
               OR     NVL(MAX(temp07.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_dntl_dtl temp08
          WHERE temp08.sak_prov_perf     = a.sak_prov
               and temp08.cde_svc_loc_perf     = a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp08.DTE_FIRST_SVC) >= :il_prev_18_months
               OR     NVL(MAX(temp08.DTE_FIRST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_dntl_hdr     temp09
          WHERE ( (temp09.prov_billing     = a.sak_prov
               and     temp09.cde_service_loc     = a.cde_service_loc)
          OR (temp09.sak_prov_perf     = a.sak_prov
               and     temp09.cde_perf_svc_loc = a.cde_service_loc)
          OR (temp09.sak_prov_referring = a.sak_prov
               and     temp09.cde_svc_loc_ref_1 = a.cde_service_loc)
          OR (temp09.sak_prov_referring_2 = a.sak_prov
               and     temp09.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp09.DTE_FINAL)     >= :il_prev_18_months
               OR     NVL(MAX(temp09.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_pharm_hdr temp10
          WHERE ( (temp10.prov_billing     = a.sak_prov
               and     temp10.cde_service_loc     = a.cde_service_loc)
          OR (temp10.sak_prov_rend     = a.sak_prov
               and     temp10.cde_svc_loc_rend = a.cde_service_loc)
          OR (temp10.sak_presc_prov     = a.sak_prov
               and     temp10.cde_svc_loc_presc = a.cde_service_loc)
          OR     temp10.id_prov_prescrb     = to_char(a.sak_prov) || a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp10.DTE_FINAL)     >= :il_prev_18_months
               OR     NVL(MAX(temp10.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_phys_dtl temp11
          WHERE ( (temp11.sak_prov_perf     = a.sak_prov
               and     temp11.cde_svc_loc_rend = a.cde_service_loc)
          OR (temp11.sak_prov_referring = a.sak_prov
               and     temp11.cde_svc_loc_ref_1 = a.cde_service_loc)
          OR (temp11.sak_prov_referring_2 = a.sak_prov
               and     temp11.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp11.DTE_LAST_SVC)     >= :il_prev_18_months
               OR     NVL(MAX(temp11.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_phys_hdr     temp12
          WHERE ( (temp12.prov_billing     = a.sak_prov
               and     temp12.cde_service_loc     = a.cde_service_loc)
          OR (temp12.sak_prov_perf     = a.sak_prov
               and     temp12.cde_perf_svc_loc = a.cde_service_loc)
          OR (temp12.sak_prov_referring = a.sak_prov
               and     temp12.cde_svc_loc_ref_1 = a.cde_service_loc)
          OR (temp12.sak_prov_referring_2 = a.sak_prov
               and     temp12.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp12.DTE_FINAL)     >= :il_prev_18_months
               OR     NVL(MAX(temp12.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_ub92_dtl temp13
          WHERE ( (temp13.sak_pr_other     = a.sak_prov
               and     temp13.cde_scv_loc_other = a.cde_service_loc)
               OR (temp13.sak_pr_other_2     = a.sak_prov
               and     temp13.cde_svc_loc_other_2 = a.cde_service_loc)
               OR (temp13.sak_pr_attend     = a.sak_prov
               and     temp13.cde_svc_loc_attend = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING     MAX(temp13.DTE_LAST_SVC)     >= :il_prev_18_months
               OR     NVL(MAX(temp13.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_ub92_hdr     temp14
          WHERE ( (temp14.prov_billing     = a.sak_prov
               and     temp14.cde_service_loc     = a.cde_service_loc)
          OR (temp14.sak_pr_facility     = a.sak_prov
               and     temp14.cde_svc_loc_fa     = a.cde_service_loc)
          OR (temp14.sak_pr_other_2     = a.sak_prov
               and     temp14.cde_svc_loc_other_2 = a.cde_service_loc)
          OR (temp14.sak_pr_attend     = a.sak_prov
               and     temp14.cde_svc_loc_attend = a.cde_service_loc)
          OR (temp14.sak_pr_other     = a.sak_prov
               and     temp14.cde_svc_loc_other = a.cde_service_loc)
          OR     temp14.id_prov_attend     = to_char(a.sak_prov) || a.cde_service_loc
          OR     temp14.id_prov_other     = to_char(a.sak_prov) || a.cde_service_loc
          OR     temp14.id_prov_other_2     = to_char(a.sak_prov) || a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp14.DTE_FINAL)     >= :il_prev_18_months
               OR     NVL(MAX(temp14.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_dental_dtl temp15
          WHERE temp15.sak_prov_perf     = a.sak_prov
               and temp15.cde_svc_loc_perf     = a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp15.DTE_FIRST_SVC) >= :il_prev_18_months
               OR     NVL(MAX(temp15.DTE_FIRST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_dental_hdr temp16
          WHERE ( (temp16.sak_prov_perf     = a.sak_prov
               and     temp16.cde_perf_svc_loc = a.cde_service_loc)
          OR (temp16.sak_prov_referring = a.sak_prov
               and     temp16.cde_svc_loc_ref_1 = a.cde_service_loc)
          OR (temp16.sak_prov_referring_2 = a.sak_prov
               and     temp16.cde_svc_loc_ref_2 = a.cde_service_loc)
          OR (temp16.prov_billing     = a.sak_prov
               and     temp16.cde_service_loc     = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING ((MAX(temp16.DTE_LAST_SVC) >= :il_prev_18_months
               OR     NVL(MAX(temp16.DTE_LAST_SVC),0) = 0)
               and (MAX(temp16.DTE_BILLED) >= :il_prev_18_months
               OR     NVL(MAX(temp16.DTE_BILLED),0) = 0) )
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phrm_hdr temp17
          WHERE ( (temp17.prov_billing     = a.sak_prov
               and     temp17.cde_service_loc     = a.cde_service_loc)
          OR (temp17.sak_prov_rend     = a.sak_prov
               and     temp17.cde_svc_loc_rend = a.cde_service_loc)
          OR (temp17.sak_presc_prov     = a.sak_prov
               and     temp17.cde_svc_loc_presc = a.cde_service_loc)
          OR     temp17.id_prov_prescrb     = to_char(a.sak_prov) || a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp17.DTE_BILLED)     >= :il_prev_18_months
               OR     NVL(MAX(temp17.DTE_BILLED),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phys_dtl temp18
          WHERE ( (temp18.sak_prov_perf     = a.sak_prov
               and     temp18.cde_svc_loc_rend = a.cde_service_loc)
          OR (temp18.sak_prov_referring = a.sak_prov
               and     temp18.cde_svc_loc_ref_1 = a.cde_service_loc)
          OR (temp18.sak_prov_referring_2 = a.sak_prov
               and     temp18.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp18.DTE_LAST_SVC)     >= :il_prev_18_months
               OR     NVL(MAX(temp18.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phys_hdr temp19
          WHERE ( (temp19.prov_billing     = a.sak_prov
               and     temp19.cde_service_loc     = a.cde_service_loc)
          OR (temp19.sak_prov_perf     = a.sak_prov
               and     temp19.cde_perf_svc_loc = a.cde_service_loc)
          OR (temp19.sak_prov_referring = a.sak_prov
               and     temp19.cde_svc_loc_ref_1 = a.cde_service_loc)
          OR (temp19.sak_prov_referring_2 = a.sak_prov
               and     temp19.cde_svc_loc_ref_2 = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING ((MAX(temp19.DTE_LAST_SVC) >= :il_prev_18_months
               OR     NVL(MAX(temp19.DTE_LAST_SVC),0) = 0)
               and (MAX(temp19.DTE_BILLED)     >= :il_prev_18_months
               OR     NVL(MAX(temp19.DTE_BILLED),0) = 0) )
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_ub92_dtl temp20
          WHERE ( (temp20.sak_pr_other     = a.sak_prov
               and     temp20.cde_scv_loc_other = a.cde_service_loc)
               OR (temp20.sak_pr_other_2     = a.sak_prov
               and     temp20.cde_svc_loc_other_2 = a.cde_service_loc)
               OR (temp20.sak_pr_attend     = a.sak_prov
               and     temp20.cde_svc_loc_attend = a.cde_service_loc)
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING     MAX(temp20.DTE_LAST_SVC)     >= :il_prev_18_months
               OR     NVL(MAX(temp20.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_ub92_hdr temp22
          WHERE ( (temp22.prov_billing     = a.sak_prov
               and     temp22.cde_service_loc     = a.cde_service_loc)
          OR (temp22.sak_pr_facility     = a.sak_prov
               and     temp22.cde_svc_loc_fa     = a.cde_service_loc)
          OR (temp22.sak_pr_other_2     = a.sak_prov
               and     temp22.cde_svc_loc_other_2 = a.cde_service_loc)
          OR (temp22.sak_pr_attend     = a.sak_prov
               and     temp22.cde_svc_loc_attend = a.cde_service_loc)
          OR (temp22.sak_pr_other     = a.sak_prov
               and     temp22.cde_svc_loc_other = a.cde_service_loc)
          OR     temp22.id_prov_attend     = to_char(a.sak_prov) || a.cde_service_loc
          OR     temp22.id_prov_other     = to_char(a.sak_prov) || a.cde_service_loc
          OR     temp22.id_prov_other_2     = to_char(a.sak_prov) || a.cde_service_loc
               GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
          HAVING MAX(temp22.DTE_BILLED)     >= :il_prev_18_months
               OR     NVL(MAX(temp22.DTE_BILLED),0) = 0
);

Perhaps an approach like this would work better. No promises, but it's worth a try.
SELECT *
  FROM pr_php_elig_tmp a
WHERE NOT EXISTS (
         SELECT   a.sak_prov,
                  a.cde_service_loc,
                  a.sak_short
             FROM aim01.t_deny_dntl_dtl temp01
            WHERE temp01.sak_prov_perf = a.sak_prov
              AND temp01.cde_svc_loc_perf = a.cde_service_loc
         GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
           HAVING MAX (temp01.dte_first_svc) >= :il_prev_18_months
               OR NVL (MAX (temp01.dte_first_svc), 0) = 0)
   AND NOT EXISTS (
         SELECT   a.sak_prov,
                  a.cde_service_loc,
                  a.sak_short
             FROM aim01.t_deny_dntl_hdr temp02
            WHERE (   (    temp02.prov_billing = a.sak_prov
                       AND temp02.cde_service_loc = a.cde_service_loc)
                   OR (    temp02.sak_prov_perf = a.sak_prov
                       AND temp02.cde_perf_svc_loc = a.cde_service_loc)
                   OR (    temp02.sak_prov_referring = a.sak_prov
                       AND temp02.cde_svc_loc_ref_1 = a.cde_service_loc)
                   OR (    temp02.sak_prov_referring_2 = a.sak_prov
                       AND temp02.cde_svc_loc_ref_2 = a.cde_service_loc))
         GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
           HAVING MAX (temp02.dte_final) >= :il_prev_18_months
               OR NVL (MAX (temp02.dte_final), 0) = 0)

Similar Messages

  • Not Updating Customized Table when System having Performance Issue

    Hi,
    This is actually the same topic as "Not Updating Customized Table when System having Performance Issue" which is posted last December by Leonard Tan regarding the user exit EXIT_SAPLMBMB_001.
    Recently we changed the program function module z_mm_save_hide_qty to update task. However this causes more data not updated. Hence we put back the old version (without the update task).  But now it is not working as it used to be (e.g. version 1 - 10 records not updated, version 2 with update task - 20 records not updated, back to version 1 - 20 records not updated).
    I tried debugging the program, however whenever I debugged, there is nothing wrong and the data is updated correctly.
    Please advise if anyone has any idea why is this happening. Many thanks.
    Regards,
    Janet

    Hi Janet,
    you are right. This is a basic rule not to do any COMMIT or RFC calls in a user exit.
    Have a look at SAP note 92550. Here they say that exit EXIT_SAPLMBMB_001 is called in the update routine MB_POST_DOCUMENT. And this routine is already called in UPDATE TASK from  FUNCTION 'MB_UPDATE_TASKS' IN UPDATE TASK.
    SAP also tells us not to do any updates on SAP system tables like MBEW, MARD, MSEG.
    Before the exit is called, now they call 'MB_DOCUMENT_BADI' with methods MB_DOCUMENT_BEFORE_UPDATE and MB_DOCUMENT_UPDATE. Possibly you have more success implementing the BADI.
    I don't know your situation and goal so this is all I can tell you now.
    Good luck!
    Regards,
    Clemens

  • How to Use SQL Query having IN Clause With DB Adapter

    Hi,
    I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
    Thanks

    invoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter

  • Pricing Engine call having performance issues

    Hello All,
    Morning need some help with this ,, we are having performance issues with the QP Pricing Engine call using seeded API : qp_preq_grp.price_request
    We are having Pricing Context setup and have about 20 pricing attributes defined/setup with different values.
    The price list is which is passed has a dynamic formula attached to it.  This formula makes use of the pricing attributes and factor lists to provide final price.
    For the Pricing control record we are passing below mentioned parameters :
    p_control_rec.pricing_event := 'LINE';
    p_control_rec.calculate_flag := 'Y';
    p_control_rec.simulation_flag := 'Y';
    p_control_rec.manual_discount_flag := 'Y';
    Could someone please assist as to how we could trace or debug this pricing performance issue , means what exactly is causing the pricing call to take time.. Is there any other way other than taking a trace file and geting a tkprof.
    meaning could something be analysed or checked within Pricing debug/trace itself to see what is causing the performance to degrade (specific to pricing debug)
    Thanks

    Since you are using a formula to come up with a price, you no longer need the calcualte price flag as 'Y' . Pass as following:
    p_control_rec.calculate_flag := 'P';  --- 'Partial Price; indicates that Pricing will not be calculated automatically by the system, but other charges will be'
    OR, if you do not need the shipping charges to be calculated as well, pass the value as :
    p_control_rec.calculate_flag := 'N';
    Please let me know.
    Regards,
    Dipanjan

  • Need help with premiere pro cs6 having performance issues please help

    need help with premiere pro cs6 having performance issues please help

    Welcome to the forum.
    First thing that I would do would be to look at this Adobe KB Article to see if it helps.
    Next, I would try the tips in this ARTICLE.
    If that does not help, a Repair Install would definitely be in order.
    Good luck,
    Hunt

  • Query giving performance issues.

    Hi All,
    Following query is giving performance issues. Query execution is taking around 11 minutes. Our client requirement is to get the data for the query in 30 sec to 1 min. Please suggest.
    SELECT
    DISTINCT r.rptid, p.product_id, p.vnd_dscr, p.vendor_cd, p.Firm_Cd, a.is_mm_sweep IsMoneyMarket
    FROM
    dev.ac_cube a,
    dev.rpt_master_rep_list_view r,
    dev.cur_ps_cube p
    WHERE a.repid = r.rep_id
    AND a.accountkey = p.accountkey
    AND p.product_id IS NOT NULL
    AND p.product_id != 'CASH'
    AND r.RPTID = '42817'
    Number of distinct records fetched by above query : 34445
    Number of records in dev.ac_cube table : 13.6 million
    Number of records in dev.cur_ps_cube table : 7 million
    Number of records in dev.rpt_master_rep_list_view for RPTID '42817' : 118354
    repid, product_id is indexed column in dev.ac_cube table. accountkey is primary key in dev.ac_cube table.
    rep_id is indexed column in base table on which dev.rpt_master_rep_list_view view is created

    The output is not complete as i expected. Have you followed the steps I have mentioned in my earlier post
    Also when posting output enclose between two {*code*} ...{*code*} (remove * within braces). It displays everything between the tags as proper formatted output otherwise its really hard to read and understand
    See sample below. However you need to get the session id, sql id, display_cursor output exactly in same way as mentioned in my previous post
    SQL> set arraysize 200 timing on serveroutput on linesize 200;
    SQL> set autotrace traceonly explain statistics;
    SQL> select level from dual  connect by level <= 10000;
    10000 rows selected.
    Elapsed: 00:00:00.09
    Execution Plan
    Plan hash value: 1236776825
    | Id  | Operation                    | Name | Rows  | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |      |     1 |     2   (0)| 00:00:01 |
    |   1 |  CONNECT BY WITHOUT FILTERING|      |       |            |          |
    |   2 |   FAST DUAL                  |      |     1 |     2   (0)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
          57406  bytes sent via SQL*Net to client
            919  bytes received via SQL*Net from client
             51  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
          10000  rows processed
    SQL>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQLs erver migration performance issue

    We are performing migration from oracle to MSSQL server 2005 (Windows 2003/SAP 4.6D).Our target system configuration is like below:
    ->OS - Windows 2003 x64
    ->DB - MSSQL server 2005 SP4
    ->SAP - 4.6 D kernel
    ->CPU - 4 processors (2.67ghz each)
    ->RAM - 16 GB
    ->source system DB size - around 1 TB and package splitting was implemented.
    While importing the export dump that came from source system, we are facing load performance issue's.
    1) We have started 10 parallel processes and after import is started, CPU is getting 95% to 99% utilized and when we check SQL server studio-> Activity monitor we  found below information:
    -There were around 20 processes are in status sleeping
    -Only one or two system processes are running with commands - INSERT,SELECT INTO commands ( column)
    -At any point of time only two processes are running and CPU utilization is hitting high.
    -Import is very slow and its taking 35 hours to complete
    We have followed few SAP notes(1054852,1241751 e.tc..) and below are the settings for SQL server:
    -Minimum server memory - 5 GB
    - Maximum server memory - 5 GB
    - index creation memory - 0
    - Maximum memory per query - 1024 kb
    - Maximum degree of parellelism - 1
    - Parallellism locks - 0
    - Cost threshold of parellism - 5
    - Enabled trace flags - 610,620,1117,1211,3917
    - Windows environment variable BCP_BATCH_SIZE = 10000
    - SQL log file size - 100 GB
    - tempdb size - 20 GB
    2) When we tried another test import after tuning parameters (Maximum degree of parellelism to 3) and increasing r3load parallel processes to 20, we found  of inserts
    are overflowing in process list and blocking other waiting processes and putting them in suspended mode.CPU utilization is at 80%
    Are there any SQL server parameters need to be tuned to fix this import load time issue in both scenarios? Are there any  best practises for migrating to SQL server?
    Thanks..

    > 1) We have started 10 parallel processes and after import is started, CPU is getting 95% to 99% utilized and when we check SQL server studio-> Activity monitor we  found below information:
    What processes is using the CPU? The SQL Server itself or others? (see task manager)
    > -Minimum server memory - 5 GB
    > - Maximum server memory - 5 GB
    For the time of the migration itself I'd give the database more memory (10 GB or more) and reconfigure later when the import is done.
    What parameters do you use for the R3load? I'd recommend
    -loadprocedure fast -merge_bck -c 10000
    and also set
    BCP_LOB=1 in the environment.
    Markus

  • SQL Query - SCOM2012R2 Performance Counter

    Need some assistance with a SQL query against my SCOM DW. I want this to do a select within a select. The inner select must collect the raw data for a performance counter, for the last 5 minutes. But SCOM will only give me counters that collected in the
    last 5 minutes. What i want is the last value for every managed instance. - 1500 servers. 
    The outer SELECT must then filter this by doing a count on how many servers it collected a value for that are above 80% - and then divide that number by the total managed servers to give me a percentage of servers above 80% memory used. Eg - it counts 10
    servers are above 80%, but theres 100 servers - then gives me a final figure of 90%. 
    select (count(abc.DaValue)) from (
      select
        vManagedEntity.Path
        ,vPerformanceRule.ObjectName
        ,vPerformanceRule.CounterName
        ,AVG(vPerfRaw.SampleValue) AS DaValue
      from vPerfRaw
        join vPerformanceRuleInstance on vPerformanceRuleInstance.PerformanceRuleInstanceRowid = vPerfRaw.PerformanceRuleInstanceRowid
        join vPerformanceRule on vPerformanceRule.RuleRowId = vPerformanceRuleInstance.RuleRowId
        join vManagedEntity on vManagedEntity.ManagedEntityRowid = vPerfRaw.ManagedEntityRowId
      where vPerfRaw.Datetime > DATEADD(minute, -20, GETUTCDATE())
      and vPerformanceRule.ObjectName = 'Memory'
      and vPerformanceRule.CounterName = 'PercentMemoryUsed'
      GROUP BY Path, ObjectName, CounterName, Name
      Order by DaValue DESC) 
      as abc
    where abc.DaValue >= 80
    This statement gives me the result
    Msg 1033, Level 15, State 1, Line 15
    The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
    Any ideas ?

    Latest update - 
    SELECT count(DISTINCT abc.server) as NoOfServers,
    count(case when abc.DaValue >= 90 then abc.DaValue end) 'MemoryAbove90%'
    FROM( select TOP 100 PERCENT 
    vManagedEntity.Path as Server ,vPerformanceRule.ObjectName 
    ,vPerformanceRule.CounterName ,AVG(vPerfRaw.SampleValue) AS DaValue
    from Perf.vPerfRaw join vPerformanceRuleInstance on vPerformanceRuleInstance.PerformanceRuleInstanceRowid = vPerfRaw.PerformanceRuleInstanceRowid
    join vPerformanceRule on vPerformanceRule.RuleRowId = vPerformanceRuleInstance.RuleRowId
    join vManagedEntity on vManagedEntity.ManagedEntityRowid = vPerfRaw.ManagedEntityRowId
    where vPerfRaw.Datetime > DATEADD(minute, -10, GETUTCDATE())
    and vPerformanceRule.ObjectName = 'Memory' and vPerformanceRule.CounterName = 'PercentMemoryUsed'
    GROUP BY Path, ObjectName, CounterName, Name
    Order by DaValue DESC)  as abc
    This gives me Total Servers collected from, and Total Servers found to have AVG collections over 90% for Memory Util. 
    My KPI states that I must only display the number of servers that are above 90%, for more than 10minutes.
    The problem with this is that when i run it over a 10 minute period, I get collections for about 40% of my managed servers only.
    I want to know if anyone has a better way of collecting the perf data over a 10 minute period ? 
    What i was thinking of doing is  running this query with time interval on 11 minutes, populating a temp table with the data, running the query
    again with time interval on 1 minute ago, and comparing the results. IF it finds a match, I know that the server has been over 90% memory util for 10 minutes - then i can count it ? Its probably not entirely accurate, but Im out of ideas. From here, i want
    to export the Values for Total Servers and TotalServersAbove90% into Excel, and build a guage off it that will reflect a % of Servers within SLA -Memory Util. 
    Im not entirely familiar with SCOM collection intervals, IF I run the query for the last 1 minute - It seems to skip alot of servers and only returns
    data from about 50, is that because its not cycling on those at that moment ? In which case my idea above wont work.
    UPDATE 2 - i think this will do it
    Our OPS guy just told me that we sample every 10min. So immediately im thinking, perhaps i can run the query for the last 11 minutes - IF more than
    1 sample is above 90%, the server is above 90% for more than 10min.
    But, when i run this query 
    select TOP 100 Percent Path, AVG(SampleValue) AS Value, DateTime  from Perf.vPerfRaw pvpr  inner join vManagedEntity vme on pvpr.ManagedEntityRowId
    = vme.ManagedEntityRowId  inner join vPerformanceRuleInstance vpri on pvpr.PerformanceRuleInstanceRowId = vpri.PerformanceRuleInstanceRowId  inner join vPerformanceRule vpr on vpr.RuleRowId = vpri.RuleRowId WHERE ObjectName = 'Memory' AND CounterName
    = 'PercentMemoryUSed' AND Datetime > DATEADD(minute, -1, GETUTCDATE()) AND SampleValue >= 90 GROUP BY Path, SampleValue, DateTime ORDER BY DateTime DESC
    I get a few servers, but some have more than 1 entry in the last 1 minute.  Which means that i cant compare 2 samples.
    Perhaps i could say if ALL samples collected per server in that 11 minute period are > 90, 
    then add 1 to MemoryAbove90% 

  • SQL query, IF ELSE issue - Help.

    I am trying to migrate data from one table to another, however I am having problems trying to figure out a small issue in my Query.
    I'm using Oracle 11g, SQL Developer 3.0
    here is my old table
    CREATE TABLE PROD.RELATED_OFFENDERS
         CREATED_DATETIME DATE ,
         LAST_UPD_DATETIME DATE ,
         LAST_UPD_ID VARCHAR2 (30 BYTE) ,
         CREATOR_ID VARCHAR2 (30 BYTE) ,
         USSC_ID NUMBER (10) ,
         REL_ORG_ID NUMBER (10)  NOT NULL ,
         REL_ORG_NAME VARCHAR2 (100 BYTE) ,
         REL_IND_NAMES VARCHAR2 (100 BYTE) ,
         REL_DOCKET_NUM VARCHAR2 (7 BYTE) ,
         REL_LEVEL_AUTH NUMBER (2) ,
         REL_LEVEL_AUTH_TEXT VARCHAR2 (240 BYTE) ,
         SENT_TYPE_CODE NUMBER (2) ,
         INDICATOR VARCHAR2 (1 BYTE)
    ALTER TABLE PROD.RELATED_OFFENDERS
        ADD CONSTRAINT RO_PK PRIMARY KEY ( REL_ORG_ID ) ;New table
    CREATE TABLE USSC_CASES.CORP_RELATED_OFFENDERS
         REL_ORG_ID NUMBER (10)  NOT NULL ,
         SENT_ID NUMBER (12)  NOT NULL ,
         DEF_TYPE_CODE NUMBER (1) ,
         DEF_TYPE_NAME VARCHAR2 (100 BYTE) ,
         REL_DOCKET_NUM VARCHAR2 (7 BYTE) ,
         REL_LVL_AUTH NUMBER (1) ,
         REL_LVL_AUTH_TEXT VARCHAR2 (240 BYTE)
    ALTER TABLE USSC_CASES.CORP_RELATED_OFFENDERS
        ADD CONSTRAINT CORP_REL_OFF_PK PRIMARY KEY ( REL_ORG_ID ) ;In the old table you will notice i have the following attributes:
    REL_ORG_NAME VARCHAR2 (100 BYTE) ,
    REL_IND_NAMES VARCHAR2 (100 BYTE) ,
    In my new table I have both columns as one called DEF_TYPE_NAME VARCHAR2 (100 BYTE).
    what I'm trying to do is use the INDICATOR column VALUE (old table) for each row and say the following in SQL code:
    (if INDICATOR = 'I' then DEF_TYPE_NAME = the value of REL IND_NAMES
    else if INDICATOR = 'O' then DEF_TYPE_NAME = the value of REL_ORG_NAME) AS DEF_TYPE_NAME
    here is my query
    INSERT INTO USSC_CASES.CORP_RELATED_OFFENDERS
    SELECT
              RO.REL_ORG_ID AS REL_ORG_ID,
              S.SENT_ID AS SENT_ID,
              DECODE(RO.INDICATOR, UPPER(TRIM('I')), 1, 2) AS DEF_TYPE_CODE,
              AS DEF_TYPE_NAME, -- here is where I'm having issues.
                    RO.REL_DOCKET_NUM AS REL_DOCKET_NUM,
              RO.REL_LVL_AUTH AS REL_LVL_AUTH,
              RO.REL_LVL_AUTH_TEXT AS REL_LVL_AUTH_TEXT
    FROM      PROD.RELATED_OFFENDERS RO,
              PROD.SENTENCES S
    WHERE     RO.USSC_ID = S.CORPSENT_USSC_ID
    AND      RO.SENT_TYPE_CODE = S.SENT_TYPE_CODE
    AND          RO.SENT_TYPE_CODE = 1
    ORDER BY REL_ORG_ID;Thanks in advance for your help.

    INSERT INTO USSC_CASES.CORP_RELATED_OFFENDERS
    SELECT  RO.REL_ORG_ID AS REL_ORG_ID,
            S.SENT_ID AS SENT_ID,
            CASE RO.INDICATOR
              WHEN 'I' THEN REL_IND_NAMES
              WHEN 'O' THEN REL_ORG_NAME
            END AS DEF_TYPE_NAME,
            RO.REL_DOCKET_NUM AS REL_DOCKET_NUM,
            RO.REL_LVL_AUTH AS REL_LVL_AUTH,
            RO.REL_LVL_AUTH_TEXT AS REL_LVL_AUTH_TEXT
      FROM  PROD.RELATED_OFFENDERS RO,
            PROD.SENTENCES S
      WHERE RO.USSC_ID = S.CORPSENT_USSC_ID
        AND RO.SENT_TYPE_CODE = S.SENT_TYPE_CODE
        AND RO.SENT_TYPE_CODE = 1
      ORDER BY REL_ORG_ID;SY.

  • SQL query slow when issued by app, fast when issued mnaually

    Hi there,
    I have a more general question about a specific Oracle behaviour.
    I update a feature from within an application. The application doesn't respond and I finally have to terminate it. I checked Oracle whether a query is running long using the following statement:
    select s.username,s.sid,s.serial#,s.last_call_et/60 mins_running,q.sql_text from v$session s
    join v$sqltext_with_newlines q
    on s.sql_address = q.address
    where status='ACTIVE'
    and type <>'BACKGROUND'
    and last_call_et> 60
    order by sid,serial#,q.piece
    The result of the above query is:
    WITH CONNECTION AS ( SELECT * FROM WW_CONN C WHERE (C.FID_FROM I
    N (SELECT FID FROM WW_LINE WHERE FID_ATTR=:B1 ) AND C.F_CLASS_ID
    FROM =22) OR (C.FIDTO IN (SELECT FID FROM WW_LINE WHERE FID_AT
    TR=:B1 ) AND C.F_CLASS_ID_TO =22) ) SELECT MIN(P.FID_ATTR) AS FI
    D_FROM FROM CONNECTION C, WW_POINT P WHERE (P.FID = C.FID_FROM A
    ND C.F_CLASS_ID_FROM = 32 AND C.FLOW = 1) OR (P.FID = C.FID_TO A
    ND C.F_CLASS_ID_TO = 32 AND C.FLOW = 2)
    I have a different tool which shows me the binding parameter values. So I know that the value for :B1 is 5011 - the id of the feature being updated. This query runs for 20 mins and longer before it eventually stops. The update process involves multiple sql statements - so this one is not doing the update but is part of the process.
    Here is the bit I do not understand: when I run the query in SQL Developer with value 5011 for :B1 it takes 0.5 secs to return a result.
    Why is it, that the sql statement takes so long when issued by the application but takes less than a second when I run it manually?
    I sent a dump of the data to the application vendor who is not able to reproduce the issue in their environment. Could someone explain to me what happens here or give me some keywords for further research?
    We are using 11gR2, 64bit.
    Many thanks,
    Rob

    Hi Rob,
    at least you should see some differences in the statistics for the different child cursor (the one for the execution in the application should show at least a higher value for ELAPSED_TIME). I would use something like the following query to check the information for the child cursors:
    select sql_id
         , PLAN_HASH_VALUE
         , CHILD_NUMBER
         , EXECUTIONS
         , ELAPSED_TIME
         , USER_IO_WAIT_TIME
         , CONCURRENCY_WAIT_TIME
         , DISK_READS
         , BUFFER_GETS
         , ROWS_PROCESSED
      from v$sql
    where sql_id = your_sql_idRegards
    Martin

  • SQL Query : Order By issue with HUGE Table

    Hello friends,
    I have been through a terrible issue with order by. I would appreciate your help. Please let me know, your input for my case:
    => if i run select query it returns result quick in some milliseconds. (sql dev. fetches 50 rows at a time)
    => if i run select query with where condition and column (say A) in where condition is even indexed and i have order by and that order by column (say B) is also indexed.
    Now, here is the issue:
    1. if no. of rows with that where condition can filter yielding small result set then order by works fine .. 1-5 sec which is good.
    2.*if no. of rows with that where condition can filter yielding Large result set, say more than 50,000 then with order by then the wait time is exponential.... i have even waited 10+ mins to get the result back for 120,000 records.*
    Is order by takes that long for 100K records ... i think something else if wrong... your pointer will really be helpful... i am very new to sql and even newer for large table case.
    I am using SQL Developer Version 2.1.1.64
    and Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    Thank you so much.
    Edited by: 896719 on Jan 11, 2013 8:38 AM

    Yes you are correct, but my concentration was on order by thing, so it will do full scan of table so i was putting that ... and was also wondering if millions of record in table should not be a issue...???
    Any way for the explain plan , when just a value in the where changes there is the huge difference i want to point out too as below:
    SELECT
    FROM
        EES_EVT EES_EVT  where APLC_EVT_CD= 'ABC' ORDER BY  CRE_DTTM DESC
    execution time : 0.047 sec
    Plan hash value: 290548126
    | Id  | Operation                    | Name        | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |             |    27 | 14688 |    25   (4)| 00:00:01 |
    |   1 |  SORT ORDER BY               |             |    27 | 14688 |    25   (4)| 00:00:01 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| EES_EVT     |    27 | 14688 |    24   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN          | XIE1EES_EVT |    27 |       |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("APLC_EVT_CD"='ABC')
    Note
       - SQL plan baseline "SYS_SQL_PLAN_6d41e6b91925c463" used for this statement
    =============================================================================================
    SELECT
    FROM
        EES_EVT EES_EVT  where APLC_EVT_CD= 'XYZ' ORDER BY  CRE_DTTM DESC
    execution : 898.672 sec.
    Plan hash value: 290548126
    | Id  | Operation                    | Name        | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |             |   121K|    62M|       |   102K  (1)| 00:11:02 |
    |   1 |  SORT ORDER BY               |             |   121K|    62M|    72M|   102K  (1)| 00:11:02 |
    |   2 |   TABLE ACCESS BY INDEX ROWID| EES_EVT     |   121K|    62M|       | 88028   (1)| 00:09:27 |
    |*  3 |    INDEX RANGE SCAN          | XIE1EES_EVT |   121K|       |       |   689   (1)| 00:00:05 |
    Predicate Information (identified by operation id):
       3 - access("APLC_EVT_CD"='XYZ')
    Note
       - SQL plan baseline "SYS_SQL_PLAN_ef5709641925c463" used for this statementAlso Note this table contains 74328 MB data in it.
    Thanks

  • SQL Query Group By Issues - Urgent

    I currently have an issue writing a pl\sql report, I can get part of the way to the results I want but the group by clause is causing problems, because I have to add more columns to the group by, dispersing the figures further, I have tried it with coalesce for each of the task types but I still get the same results, I am getting close to the results I need but not quite there yet. I would really appreciate it if someone could take at look at this for me as it is an urgent requirement.
    The report is based on the tables similar to the following:
    TASKS, ORGANISATIONS, POSITIONS
    A position is a member of an organisation.
    A task has a position assigned to it.
    The SQL for the tables and to insert the data that would produce the report is detailed below:
    CREATE TABLE TASKS
    (     TASK_ID NUMBER NOT NULL ENABLE,
         TASK_TYPE VARCHAR2 (15 BYTE) NOT NULL ENABLE,
         STATUS VARCHAR2 (15 BYTE) NOT NULL ENABLE,
         POS_ID NUMBER NOT NULL ENABLE,
         CONSTRAINT TASKS_PK PRIMARY KEY (TASK_ID));
    CREATE TABLE ORGANISATIONS
    (     ORG_ID NUMBER NOT NULL ENABLE,
         ORG_NAME VARCHAR2 (15 BYTE) NOT NULL ENABLE,
         CONSTRAINT ORGANISATIONS_PK PRIMARY KEY (ORG_ID));
    CREATE TABLE POSITIONS
    (     POS_ID NUMBER NOT NULL ENABLE,
         POS_NAME VARCHAR2 (25 BYTE) NOT NULL ENABLE,
         ORG_ID NUMBER NOT NULL ENABLE,
         CONSTRAINT POSITIONS_PK PRIMARY KEY (POS_ID));
    INSERT INTO ORGANISATIONS (ORG_ID, ORG_NAME) VALUES (1,'ABC');
    INSERT INTO ORGANISATIONS (ORG_ID, ORG_NAME) VALUES (2,'DEF');
    INSERT INTO ORGANISATIONS (ORG_ID, ORG_NAME) VALUES (3,'EFG');
    INSERT INTO POSITIONS (POS_ID, POS_NAME, ORG_ID) VALUES (1,'ABC-1', 1);
    INSERT INTO POSITIONS (POS_ID, POS_NAME, ORG_ID) VALUES (3,'ABC-2', 1);
    INSERT INTO POSITIONS (POS_ID, POS_NAME, ORG_ID) VALUES (2,'ABC-3', 1);
    INSERT INTO POSITIONS (POS_ID, POS_NAME, ORG_ID) VALUES (5,'DEF-2', 2);
    INSERT INTO POSITIONS (POS_ID, POS_NAME, ORG_ID) VALUES (4,'DEF-1', 2);
    INSERT INTO POSITIONS (POS_ID, POS_NAME, ORG_ID) VALUES (7,'EFG-1', 3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (12,'TASK_TYPE_3','LIVE',3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (11,'TASK_TYPE_2','LIVE',3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (10,'TASK_TYPE_2','LIVE',2);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (9,'TASK_TYPE_2','LIVE',2);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (8,'TASK_TYPE_1','LIVE',3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (7,'TASK_TYPE_1','LIVE',3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (6,'TASK_TYPE_1','LIVE',3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (5,'TASK_TYPE_1','LIVE',3);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (4,'TASK_TYPE_1','LIVE',2);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (3,'TASK_TYPE_3','LIVE',1);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (2,'TASK_TYPE_1','LIVE',1);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (1,'TASK_TYPE_1','LIVE',1);
    INSERT INTO TASKS (TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (13,'TASK_TYPE_3','LIVE',3);
    The report should detail the following information based on the information in the tables:
    1st Column
    Organisation
    ABC
    DEF
    EFG
    2nd Column
    No. of Positions in Organsiation
    3
    2
    1
    With total of the number of people in all of the organisation 6
    3rd Column
    Number of tasks assigned to the organisation of task type1
    2
    1
    4
    4th Column
    Number of tasks assigned to the organisation of task type 2
    0
    2
    1
    5th Column
    Number of tasks assigned to the organisation of task type 3
    1
    0
    2
    Total no of tasks assigned to the Organisation
    3
    3
    7
    Message was edited by:
    Suzy_r_82
    Message was edited by:
    Suzy_r_82

    Hi,
    Apologies, my insert statements where incorrect, if you try the data below instead it should give you output I was expecting
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (1,'TASK_TYPE_1', 'LIVE',1);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (2,'TASK_TYPE_1', 'LIVE',2);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (3,'TASK_TYPE_1', 'LIVE',5);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (4,'TASK_TYPE_1', 'LIVE',7);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (5,'TASK_TYPE_1', 'LIVE',7);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (6,'TASK_TYPE_1', 'LIVE',7);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (7,'TASK_TYPE_1', 'LIVE',7);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (8,'TASK_TYPE_2', 'LIVE',4);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (9,'TASK_TYPE_2', 'LIVE',5);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (10,'TASK_TYPE_3', 'LIVE',1);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (11,'TASK_TYPE_3', 'LIVE',7);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (12,'TASK_TYPE_2', 'LIVE',7);
    INSERT INTO TASKS( TASK_ID, TASK_TYPE, STATUS, POS_ID) VALUES (13,'TASK_TYPE_3', 'LIVE',7);
    The results I would like are
    ORG    No. of Pos     No of Task    No of Task     No of Task     Total no
               In Org           Type1 for      Type2 for        Type3 for       of Tasks
                                   Org             Org                Org               for Org
    ABC        3                   2                 0                   1                   3
    DEF        2                   1                 2                   0                   3
    EFG        1                   4                 1                   2                   7
    Total        6The results I get are multiple lines for each organisation, I would like to rollup these lines so I can have one line per organisation.
    Hope this helps a bit more, I appreciate the help, let me know if you need more information
    Thanks
    Suzy

  • Query on Performance issues relating to a report

    Hi Group,
    I have an issue while running a report which was creating Business Partners for (both Company and the Contact person and as well as relationship b/w them).
    This report was having BAPI( for creating Business Partners ) and also for creating relationships and the report was taking too much of response time.
    I was thinking it to be the reason for calling BAPIs. But, I want to know from you that is that the real cause or it might be the other cause.
    So please kindly let me know inputs from your side on this.
    thanks in advance.
    Regards,
    Vishnu.

    Hi
    I think it's always better to use the provided standard fm's and bapi's to make changes to the data in the system instead of directly placing them in the tables.
    One thing you can do is try to use parallel processing. E.g 10.000 BP's should be created. In that case schedule 4 jobs to create the Bp's instead of 1 job creating the whole lot.
    Kind regards, Rob Dielemans

  • SQL Query Sorting Order issue - Help needed

    Hi All,
    I am using the following query in my project to display the records in the grid.
    /* Formatted on 04-09-2013 PM 8:01:51 (QP5 v5.149.1003.31008) */
      SELECT eol,
             status_msg,
             relation,
             building_name,
             device_id id,
             CEIL (SYSDATE - updated_date) duration,
             lab_id,
             aisle_id,
             aisle_location_id,
             ip_address,
             port,
             slot_num,
             hostname,
             pid,
             description,
             sl_num,
             eitms_code,
             status,
             dnd_flag,
             aisle,
             aisle_location,
             spname,
             os_version,
             user_id,
             TO_CHAR (updated_date, 'YYYY-MM-DD HH24:MI:SS') updated_date,
             isterm_svr,
             net_type,
             DEVICE_GROUP_REF,
             cmd_id_ref,
             LISTAGG (TESTBED_ID, ',') WITHIN GROUP (ORDER BY TESTBED_ID)
                AS testbeds_id_ref,
             LISTAGG (NAME, ',') WITHIN GROUP (ORDER BY TESTBED_ID)
                AS testbeds_names,
             spname || '-' || ip_address || '-' || port AS child_asset_group
        FROM DEVICE_TESTBED_VW
       WHERE lab_id IN
                ('7099849',
                 '10769617',
                 '4258712',
                 '10513562',
                 '10515074',
                 '5882676',
                 '8330925')
    GROUP BY eol,
             status_msg,
             relation,
             device_id,
             lab_id,
             aisle_id,
             aisle_location_id,
             ip_address,
             port,
             slot_num,
             hostname,
             pid,
             description,
             sl_num,
             eitms_code,
             status,
             dnd_flag,
             aisle,
             aisle_location,
             spname,
             os_version,
             user_id,
             updated_date,
             isterm_svr,
             net_type,
             DEVICE_GROUP_REF,
             cmd_id_ref,
             building_name
    ORDER BY building_name ASC,
             LOWER (child_asset_group) ASC,
             LOWER (relation) DESC
    The problem is , if any one sorting with any column  , the order is not correct
    In this below code , i have done sorting by port . But the result data order is not correct .
    /* Formatted on 04-09-2013 PM 8:07:02 (QP5 v5.149.1003.31008) */
      SELECT eol,
             status_msg,
             relation,
             building_name,
             device_id id,
             CEIL (SYSDATE - updated_date) duration,
             lab_id,
             aisle_id,
             aisle_location_id,
             ip_address,
             port,
             slot_num,
             hostname,
             pid,
             description,
             sl_num,
             eitms_code,
             status,
             dnd_flag,
             aisle,
             aisle_location,
             spname,
             os_version,
             user_id,
             TO_CHAR (updated_date, 'YYYY-MM-DD HH24:MI:SS') updated_date,
             isterm_svr,
             net_type,
             DEVICE_GROUP_REF,
             cmd_id_ref,
             LISTAGG (TESTBED_ID, ',') WITHIN GROUP (ORDER BY TESTBED_ID)
                AS testbeds_id_ref,
             LISTAGG (NAME, ',') WITHIN GROUP (ORDER BY TESTBED_ID)
                AS testbeds_names,
             spname || '-' || ip_address || '-' || port AS child_asset_group
        FROM DEVICE_TESTBED_VW
       WHERE lab_id IN
                ('7099849',
                 '10769617',
                 '4258712',
                 '10513562',
                 '10515074',
                 '5882676',
                 '8330925')
    GROUP BY eol,
             status_msg,
             relation,
             device_id,
             lab_id,
             aisle_id,
             aisle_location_id,
             ip_address,
             port,
             slot_num,
             hostname,
             pid,
             description,
             sl_num,
             eitms_code,
             status,
             dnd_flag,
             aisle,
             aisle_location,
             spname,
             os_version,
             user_id,
             updated_date,
             isterm_svr,
             net_type,
             DEVICE_GROUP_REF,
             cmd_id_ref,
             building_name
    ORDER BY PORT ASC
    Can some one help me to fix this issue?

    Hi,
    Sorry, it's not clear what you want.
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    Simplify the problem as much as possible. For example, if you really need to GROUP BY 28 columns, post a problem where you need to GROUP BY only 2 or 3 columns.  (Just explain that you really have 28, so people will give solutions that are sure to work for all 28).)
    Always say which version of Oracle you're using (for example, 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Why am I having performance Issues with an upgrade from CS2 to CS5.5?

    I am struggling hard with an upgrade from InDesign CS2 to CS5.5 (part of CS5.5 Design Standard)
    There is a very slow response when trying to produce a 45 page document which needs many .jpeg images inserting, sometimes up to six on each 3-column page. While InDesign behaves sort of normally on text only pages, it slows to a virtual standstill when on the pages with images. (But this is what its for and I didn't have this problem with CS2!!)
    Having read through some of the postings on this topic I have followed all the advice without success :-( 
    1) disable LSD in Preferences – Interface
    2) disable thumbnail display in Pages
    3) adjust view settings to Typical with Raster and Vector Images greyed out
    4) disable Save Preview Images with Documents
    5) check Links before opening documents
    7) switch Preflight off
    I shouldn't need to do all this should I???
    I am operating with the following:
    Packard Bell ixtreme M5740 64 bit
    Intel Core i5 CPU [email protected]
    4.0 GB RAM
    ATII Radeon HD5570 graphics card 2779 MB available memory, 1024MB dedicated
    plenty of free space – 274GB on c: drive and 296 GB on a D: drive
    My hardware conforms to/exceeds the Indesign recommended hardware spec. Oh yes I am working on my local drive and  I don't have these problems with Photoshop or Illustrator CS5.5.
    Has anyone an idea about what's going on?
    I've lost a good 6-8 hours so far trying to sort it out. Any help and observations will be gratefully received!

    Hi Peter
    Thanks - I've found that the files were marked as 'hidden' and thus by switching them on gain I was able to recreate the original location.  Regrettably this has had absolutely no effect on my problem. :-( 
    I have now created a  fresh document, studiously linking all my images properly  (similar number to a DK 'Eyewitness Travel Guide') and by the time I got halfway through its 80 pages, InDesign had slowed to a crawl - ie 15-20 seconds to respond to any command.  It is clearly doing something that it thinks necessary despite all the 'workarounds' people have suggested. Please please Adobe what's going on???

Maybe you are looking for

  • Going over to MAC.

    I have CC apps on subscription. If I swap over to MAC from Windows. Can I just download them again?

  • Scheduled payments

    Why doesn't verizon allow you to schedule a payment in advance? 

  • Error when calling BAPI from web dynpro

    Hi, I have a program that calls a BAPI to retrieve data. The problem is that i have the following error message: com.sap.dictionary.runtime.DdException: 'WD_RFC_LOADBL_META' not properly defined! Unable to create Metadata connection for Dictionary Pr

  • User define document

    hi all Here my question is what is the business object for user define document? please give me reply Thanks & Regards Amit

  • Dbms_scheduler.Create_Scheduler Usage.

    Hi all, I am using 10.2.0.4.0 version of oracle. i am supposed to migrate all the Oracle jobs(DBMS_JOBS) to SCHEDULER format in my DB. Below is an example of a job which runs each day at 5 AM. I have coded the start_date value such that, i can execut