More than 2 structures in a BEx query

Hi guys,
  Is it possible to define more than 2 local/global STRUCTURE for a particular query ?

Eugene mate,
   Okay, so now I understood that I need one Structure just for Key Figure
   Now, my precise question is this !
   I need Profit Centre to be on my Row.
   Here, I need to make 'Selections' where I make restrictions based on my Hierarchy such as Business Units, Function Units, Subsidiaries.
   I also need Cost Elements to be on my Column.
   Here, I need to make 'Selections' where I make restrictions based on my Hierarchy such as Taxation, Depreciation and so on.
  Hence, how can contain this selections when I am left with only 1 Structure ?
  Kindly advice what would your goodself suggest ?

Similar Messages

  • More than two structures in query

    Is it possible to use more than two structures in query?

    Hi,
      you can have only two structures in a query. by default you will have one in the columns. And you can have one in the rows.

  • Query on a table runs more than 45mins(after stats) and same query runs 19secs(before stats - rebuild)

    Query on a table runs more than 45mins(after stats) and same query runs 19secs(before stats - rebuild) - Not sure what the cause is.
    - Analysed the explain the plan
    - different explain plan used afterr stats gather.
    Any idea what could be the cause with this kind of difference.
    Thank you!

    What is the difference you see in the explain plan ? Where it spends most time. All these needs to be analysed.

  • Can't SSAS engines make use of more than one aggregation to answer a query?!

    I have a very simple cube (just for testing and training) . This cube contains two dimensions: [Dim Soccer Player] contains one attribute hierarchy [player name], the other dimension
    is [Dim Match Acts] contains also one attribute [Acts] which has values like fouls, goals, saves, tackles… etc. And of course a Fact that contains one measure of Just Count ... that simple ... so this cube can
    answers a question like how many goals scored by "Messi", for example ... a very simple trivial cube.
    I'm testing aggregations and their effect. so first I've designed one aggregation (Aggregation 0) on the granularity level of [Player name], then
    I run a query to get the count of ALL the[Acts] done by each [Player name] ... I've checked the SQL Profiler and I found that the aggregation was used.
    Then I cleared the cache, and I run another query, but this time to get just the number of Fouls committed by each [Player name], I checked the Profiler but the Aggregation 0 was NOT used.
    I went back to the aggregations design tab in BIDS, and I added another new aggregation (Aggregation 1) on the level of [Acts], so now I have two aggregation one on the granularity level of
    [Player name] and the second on the level of the [Acts].... I cleared the cache again and rerun the last query. NONE of the aggregation was used!
    In the third test I deleted Aggregation 1 and added [Acts] to Aggregation 0. so Aggregation 0 now on both [Player name] AND [Acts]... cleared the cache and rerun the last query. Aggregation
    0 appeared again.
    I just want to make sure (and if possible know why) the SSAS engine can't make use of and combine more than one aggregation to serve a query (point number 2), and that to design an aggregation
    that will serve a query which contains attributes from different dimensions, I have to add ALL the attributes in that query in that one aggregation, like point 3 ... is this true?!

    I think you are on the right track. You need to include all the attributes used in one query in the same aggregation (like #3) for it to be used. Example #2 works as I would expect. Queries above the grain of the agg (query by player name and an agg by
    player/act can be used) can be used. Queries below grain of the agg (example #2) can't use the agg.
    http://artisconsulting.com/Blogs/GregGalloway

  • API to access query structure / bad performance Bex query processor

    Hi, we are using a big P&L query structure. Each query structure node selects a hierarchy node of the account.
    This setup makes the performance incredible bad. The Bex query processor caches and selects per structure node - which creates an awful mass of unnecessary SQL statements. (It would be more useful to try to merge the SQL statements as far as possible with an group by account to generate bigger SQL statements.)
    The structure is necessary to cover percentage calculations in the query, the hierarchy is used to “calculate” subtotals by selecting different nodes on different levels.
    I am searching now for a different approach to cover the reporting requirement - or - for a API to generate out of the master structure smaller query structures per area of the P&L. It there any class to access the query structure?
    We tried already to generate data entries per node level (duplicating one data record per node where it appears with an characteristic for the node name). But this approach generates too many data records.
    Not using hierarchy nodes would make the maintenance terrible. To generate "hard" selections in the structure out of the hierarchy an API to change the structure be also useful.

    The problem came from a wrong development of exit varibale used in Analysis Authorization
    Edited by: SSE-BW-Team SSE-BW-Team on Feb 28, 2011 1:46 PM

  • Structure copy in BEx query Designer?

    I created structure in BEx Query Designer in BI PRD which is our BI production system.
    I'd like to copy structure to BI DEV which is our BI development system.
    Is is possible?
    If you have any solution, tell me about that.
    Thanks.

    Hi
    If you want the object which is there in PRD to DEV system means, the only way is to do transportation. but to do reverse transportation, you should have STMS connection from your PRD to DEV system.
    The better way is to create the structure again in DEV system.
    If you want to go with reverse transportation, consult your basis person.
    Regards,
    Venkatesh

  • How to use more than one ":1" in a ViewObject query

    I have a ViewObject,which has a SQL glued below.In this sql I am using ":1" twice but while I try to run this sql I am getting this error message
    "JBO-29000: Unexpected exception caught: oracle.jbo.SQLStmtException, msg=JBO-27122: SQL error during statement preparation."
    SELECT * FROM ACTIVITIES
    WHERE
    SUB_TYPE_CODE =
    case
    when(:1 IS NULL) THEN SUB_TYPE_CODE ELSE :1
    END
    If I remove one :1 then it is working fine.
    Can any one help me out plss?

    Hi,
    you can use the bind variable more than once. Can you put your SQL into another query tool such as SQL Developer and run it?
    ps, looking at your code what you may actually want its:
    SELECT * FROM ACTIVITIES
    WHERE
    SUB_TYPE_CODE = NVL(:1, SUB_TYPE_CODE )
    bit simpler?
    Brenden

  • More than 10 cards in a Snapshot Query

    Can the 5.0 UI be changed to allow more than 10 cards to appear in a Snapshot Query? 10 is currently the largest value available in the dropdown.

    Has anyone come up with a solution to this problem? In 4.5ws it was quite easy to fix.

  • How to use between more than 3 times in a single query?

    is there any other query to run this query??
    SELECT IDSITE,IDVISIT,trim(initcap(page_path)),KEYWORDS,LOCATION_IP,REFERER_NAME,REFERER_URL,VISIT_ACTION_TIME,count(DISTINCT location_ip) from web_stats where idvisit between '441' and '456' and where idsite='1' and visit_action_time between '4-jun-11' and '6-jun-11' group by trim(initcap(page_path)) and order by visitid;
    Edited by: 863765 on Jul 7, 2011 4:21 AM

    863765 wrote:
    is there any other query to run this query??
    SELECT IDSITE,IDVISIT,trim(initcap(page_path)),KEYWORDS,LOCATION_IP,REFERER_NAME,REFERER_URL,VISIT_ACTION_TIME,count(DISTINCT location_ip) from web_stats where idvisit between '441' and '456' and where idsite='1' and visit_action_time between '4-jun-11' and '6-jun-11' group by trim(initcap(page_path)) and order by visitid;That query doesn't even have valid syntax. Too many WHERE's and too many AND's and dates being treated as strings, and not the right number of grouping columns...
    Something like this is more likely to work.
    SELECT IDSITE
          ,IDVISIT
          ,trim(initcap(page_path))
          ,KEYWORDS
          ,LOCATION_IP
          ,REFERER_NAME
          ,REFERER_URL
          ,VISIT_ACTION_TIME
          ,count(DISTINCT location_ip)
    from   web_stats
    where  idvisit between '441' and '456'
    and    idsite='1'
    and    visit_action_time between to_date('04-jun-2011','DD-mon-YYYY') and to_date('06-jun-2011','DD-mon-YYYY')
    group by IDSITE
            ,IDVISIT
            ,trim(initcap(page_path))
            ,KEYWORDS
            ,LOCATION_IP
            ,REFERER_NAME
            ,REFERER_URL
            ,VISIT_ACTION_TIME
    order by visitid;Note: assuming visit_action_time is a DATE datatype, the comparison should be against DATE datatypes also, rather than strings, so you should use TO_DATE to conver those strings to dates. It's also good practice to use 4 digit years rather than 2 digit years, as we had to solve all the 2 digit year millenium bug issues back in the late 90's; we don't want to have to do that again now do we?

  • Group by returning more than one column in a single query

    Hello,
    Sorry to ask such a simple question I guess, but here is my problem.
    I'm building a query to get say the smallest user_id from employees in the company by department.
    The query goes like :
    select emp..department,
    min(emp.user_id)
    from employee emp
    group by emp.department
    This gives me the smallest user id by department, which is what I want. But how can I also get the name of that person ?
    I know that the "min" condition singles out a unique record (there are no two persons with the same user_id in the department).
    But how can I also get the name without turning the above query in a subquery that I would link to the employee table yet again ?
    I know the following works but I don't think it's the best option:
    select v1.department,
    v1.user_id,
    emp1.name
    from employee emp1,
    ( select emp..department,
    min(emp.user_id)
    from employee emp
    group by emp.department) v1
    where emp1.user_id = v1.user_id
    This is just an example of data. It is the principle that I don't quite get.
    Any advice would be very much appreciated.
    Cyril

    Hi, Cyril,
    To find the name of the person who has the lowest user_id
    SELECT    department
    ,         MIN (user_id)   AS lowest_user_id
    ,         MIN (name) KEEP (DENSE_RANK FIRST ORDER BY user_id)  AS person_with_lowest_user_id
    FROM      emp
    GROUP BY  department;"MIN (name)" above means that if there is a tie for the lowest user_id, then the contender with the first name will be chosen.
    If you want to display several columns from the row with the lowest user_id, you have to have a separate "KEEP (DENSE_RANK ...)" expression for each column. In that case, you may find it easier to use the analytic RANK or ROW_NUMBER in a sub-query, like this:
    WITH  sub_query  AS
         SELECT  department
         ,     user_id
         ,     name
         ,     col2, col3, col4, col5
         ,     RANK () OVER ( PARTITION BY  department
                               ORDER BY          user_id
                        )  AS r_num
         FROM     emp
    SELECT     *     -- or list all columns EXCEPT r_num
    FROM     sub_query
    WHERE     r_num = 1;

  • How to display ALV list with more than 1 structure?

    Hello everyone,
    I am using REUSE_ALV_LIST_DISPLAY to generate a report that displays vendor/customer items with purchases/sales total. I have 2 internal table for this. For every vendor/customer i need a total table right after, this have a different structure. I cannot use REUSE_ALV_BLOCK_LIST_ as this is not capable of calculating the subtotal per currency and from the documentation it says do not use.
    Any idea on how to proceed?
    Thanks!

    Call ALV list function module per table structure.
    Closing this thread.

  • How to replace the structure in the BI Query

    Hi Guys
    We have a query and we have a structure in the ROWS section. We want to replace this structure with another one which is aviable in the query.
    For some reason i am able to remove the structure from the ROWS section but i am unable to drag a new structure in the ROWS section. Any idea what i am doing wrong. We are on BI 7.0 version.

    Hi Pravender,
    Thanks for the quick response. I have tried that option and it does not work.
    I am able to remove the existing structure from the ROWS section of the query and able to save the query. When i go back and try to drag and drop the new structure it does not allow me to drag and drop the new structure availble in the query.
    apologies for my ignorance. I am new to BI so i might be doing something wrong. Does the structure needs to have any specific properties to be able to drag and drop? I have more than 10 structures availble in the query but i am unable to drag and drop anyone in the ROWS section.

  • How to find out which sub query returns more than one row

    Hi all,
    Can any one give me clue ,how to find out which sub query returns more than one row in the following query .
    /* Formatted on 2011/05/17 19:22 (Formatter Plus v4.8.8) */
    SELECT a.*, ROWNUM AS rnm
      FROM (SELECT DISTINCT '1' AS "Page View", ou.org_unit_name AS "Org",
                            prxm.mbr_idntfr AS "Beneficiary ID",
                               md.last_name
                            || ', '
                            || md.first_name AS "Beneficiary Name",
                            pci.idntfr AS "Tracking No.",
                            TO_CHAR (TRUNC (req.pa_rqst_date),
                                     'MM/dd/yyyy'
                                    ) AS "Request Date",
                            sts.status_name AS "Status",
                            req.pa_rqst_sid AS "Request #",
                            prxm.mbr_sid AS "Mbr_sid",
                            TO_CHAR
                                  (TRUNC (req.pa_revision_date),
                                   'MM/dd/yyyy'
                                  ) AS "Last Updated",
                            TO_CHAR (psd.TO_DATE, 'MM/dd/yyyy') AS "TO_DATE",
                            prxpl.prvdr_lctn_iid AS "PRVDR_LCTN_IID",
                            pd.prvdr_sid AS "PRVDR_SID", 'Y' AS "State View",
                            DECODE
                               ((SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                0, (SELECT prxplo.prvdr_lctn_idntfr
                                      FROM pa_request_x_provider_location prxplo
                                     WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                       AND prxplo.oprtnl_flag = 'A'
                                       AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT prxplo.prvdr_lctn_idntfr
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT DISTINCT pd.national_prvdr_idntfr
                                            FROM pa_request_x_provider_location prxplo
                                           WHERE prxplo.pa_rqst_sid =
                                                                   req.pa_rqst_sid
                                             AND prxplo.oprtnl_flag = 'A'
                                             AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "NPI/ID",
                            DECODE
                               ((SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                NULL, (SELECT    pd.last_name
                                              || ', '
                                              || pd.first_name
                                              || ' '
                                              || pd.middle_name
                                         FROM pa_request_x_provider_location prxplo
                                        WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                          AND prxplo.oprtnl_flag = 'A'
                                          AND prxplo.pa_prvdr_type_lkpcd = 'RR'),
                                (SELECT pd.org_bsns_name
                                   FROM pa_request_x_provider_location prxplo
                                  WHERE prxplo.pa_rqst_sid = req.pa_rqst_sid
                                    AND prxplo.oprtnl_flag = 'A'
                                    AND prxplo.pa_prvdr_type_lkpcd = 'RR')
                               ) AS "Prvdr Name",
                            TO_CHAR (psd.from_date,
                                     'MM/dd/yyyy'
                                    ) AS "Srvc From Date",
                            TO_CHAR (req.validity_start_date,
                                     'MM/DD/YYYY'
                                    ) AS "Due Date",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>Left",
                            req.pa_mode_type_lkpcd AS "Source",
                            TO_CHAR (TRUNC (wmdtl.rtng_date),
                                     'MM/dd/yyyy'
                                    ) AS "Assigned On",
                            NVL (wmdtl.assigned_to_user_name,
                                 'Not Assigned'
                                ) AS "Assigned To",
                            req.org_unit_sid AS "OrgUnitSid",
                            TO_CHAR
                                 (wmdtl.modified_date,
                                  'MM/dd/yyyy hh24:mi:ss'
                                 ) AS "WTRD_MODIFIED_DATE",
                            TO_CHAR (wmdtl.rtng_date,
                                     'MM/dd/yyyy'
                                    ) AS "WTRD_RTNG_DATE",
                            req.status_cid AS "PA_STATUS_CID",
                            TO_CHAR (req.modified_date,
                                     'MM/dd/yyyy'
                                    ) AS "PA_REQ_MODIFIED_DATE",
                            prs.state_pa_srvc_type_code
                                                     AS "STATE_PA_SRVC_TYPE_CODE",
                            wmdtl.wm_pa_task_rtng_dtl_sid
                                                        AS "WM_TASK_RTNG_DTL_SID",
                            wmdtl.assigned_to_user_acct_sid
                                              AS "WTRD_Assigned_to_user_acct_sid",
                            (fn_get_busniess_days (TRUNC (req.validity_start_date))
                            ) AS "Days<br>LeftSort",
                            wmdtl.assigned_to_org_unit_sid
                                                  AS "WTRD_Assigned_to_OrgUntSid",
                            DECODE
                               ((SELECT COUNT (*)
                                   FROM pa_request_status prs
                                  WHERE prs.pa_rqst_sid = req.pa_rqst_sid
                                    AND prs.status_cid = 5
                                    AND prs.oprtnl_flag = 'I'),
                                0, 'N',
                                'Y'
                               ) AS "SHOW_UTILIZATION"
                       FROM   pa_request req,
                             pa_certification_identifier pci,
                             status sts,
                             pa_request_x_member prxm,
                             wm_pa_task_routing_detail wmdtl,
                             pa_service_date psd,
                             org_unit ou,
                             pa_request_service prs,
                             pa_request_x_provider_location prxpl,
                             provider_location pl,
                             provider_detail pd,
                             provider p,
                             mbr_dmgrphc md
                      WHERE req.oprtnl_flag = 'A'
                        AND req.status_cid NOT IN
                                     (20, 30, 70, 25, 80, 96, 85, 5, 97, 98, 101)
                        AND req.org_unit_sid IN
                               (3057, 3142, 3058, 3143, 3059, 3144, 3060, 3145,
                                3061, 3146, 3062, 3147, 3063, 3148, 3064, 3149,
                                3065, 3150, 3066, 3151, 3067, 3152, 3068, 3153,
                                3069, 3154, 3070, 3155, 3071, 3156, 3072, 3157,
                                3073, 3158, 3074, 3159, 3075, 3160, 3076, 3161,
                                3077, 3162, 3078, 3163, 3079, 3164, 3080, 3165,
                                3081, 3166, 3082, 3167, 3083, 3168, 3084, 3169,
                                3085, 3170, 3086, 3171, 3087, 3172, 3088, 3173,
                                3089, 3174, 3090, 3175, 3091, 3176, 3092, 3177,
                                3093, 3178, 3094, 3179, 3095, 3180, 3096, 3181,
                                3097, 3182, 3098, 3183, 3099, 3184, 3100, 3185,
                                3101, 3186, 3102, 3187, 3103, 3003, 75000104,
                                75000108, 2006, 75000103, 75000102, 75000113,
                                75000111, 75000109, 2001, 2009, 75000105,
                                75000107, 2004, 2010, 2013, 2014, 2005, 2011,
                                75000112, 2002, 1001, 2012, 75000106, 2007,
                                75000101, 2003, 75000110, 2008, 3001, 3002, 3019,
                                3104, 3020, 3105, 3021, 3106, 3022, 3107, 3023,
                                3108, 3024, 3109, 3025, 3110, 3026, 3111, 3027,
                                3112, 3028, 3113, 3029, 3114, 3030, 3115, 3031,
                                3116, 3032, 3117, 3033, 3118, 3034, 3119, 3035,
                                3120, 3036, 3121, 3037, 3122, 3038, 3123, 3039,
                                3124, 3040, 3125, 3041, 3126, 3042, 3127, 3043,
                                3128, 3044, 3129, 3045, 3130, 3046, 3131, 3047,
                                3132, 3048, 3133, 3049, 3134, 3050, 3135, 3051,
                                3136, 3052, 3137, 3053, 3138, 3054, 3139, 3055,
                                3140, 3056, 3141)
                        AND req.pa_rqst_sid = prs.pa_rqst_sid
                        AND prs.oprtnl_flag = 'A'
                        AND prs.pa_rqst_srvc_sid = psd.pa_rqst_srvc_sid
                        AND psd.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = pci.pa_rqst_sid
                        AND pci.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxm.pa_rqst_sid
                        AND prxm.oprtnl_flag = 'A'
                        AND md.oprtnl_flag = 'A'
                        AND md.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN md.from_date AND md.TO_DATE
                        AND prxm.mbr_sid = md.mbr_sid
                        AND ou.org_unit_sid = req.org_unit_sid
                        AND ou.oprtnl_flag = 'A'
                        AND req.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxm.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND pci.pa_rqst_sid = prxm.pa_rqst_sid
                        AND pci.pa_rqst_sid = wmdtl.subsystem_task_sid
                        AND pci.pa_rqst_sid = prxpl.pa_rqst_sid
                        AND prxpl.pa_prvdr_type_lkpcd = 'RR'
                        AND prxpl.oprtnl_flag = 'A'
                        AND req.status_cid = sts.status_cid
                        AND sts.status_type_cid = 3
                        AND sts.oprtnl_flag = 'A'
                        AND prxpl.prvdr_lctn_iid = pl.prvdr_lctn_iid
                        AND p.prvdr_sid = pd.prvdr_sid
                        AND p.prvdr_sid = pl.prvdr_sid
                        AND pd.oprtnl_flag = 'A'
                        AND pd.status_cid = 2
                        AND TRUNC (SYSDATE) BETWEEN pd.from_date AND pd.TO_DATE
                        AND wmdtl.subsystem_task_sid = req.pa_rqst_sid
                        AND wmdtl.subsystem_lkpcd = 'PA'
                        AND wmdtl.oprtnl_flag = 'A'
                        AND req.pa_rqst_date > (SYSDATE - 365)
                                       ORDER BY TO_DATE ("Request Date", 'MM/dd/yyyy hh24:mi:ss') DESC,
                            "Beneficiary Name" ASC) a
    WHERE ROWNUM < 102;regards,
    P Prakash
    Edited by: BluShadow on 17-May-2011 15:01
    added {noformat}{noformat} tags around the code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    833560 wrote:
    Can any one give me clue ,how to find out which sub query returns more than one row in the following query .This is why smaller, simpler queries are easier to work with than huge ones - when something like this goes wrong smaller queries are much eaiser to debug. Unfortunately using smaller, easier-to-work with queries is not always an option
    Ganesh is right - you will have to dissect the big query bit by bit until you find the offending subquery. If there is another way I would like to find out about it too.
    The easiest way to do this is probably to use block comments to isolate parts of the query bit by bit until you find the offending part. If you carefully examine the subqueries you might be able to figure out which one is returning multiple rows without commenting everything
    Good luck!

  • Query taking long time for EXTRACTING the data more than 24 hours

    Hi ,
    Query taking long time for EXTRACTING the data more than 24 hours please find the query and explain plan details below even indexes avilable on table's goe's to FULL TABLE SCAN. please suggest me.......
    SQL> explain plan for select a.account_id,round(a.account_balance,2) account_balance,
    2 nvl(ah.invoice_id,ah.adjustment_id) transaction_id,
    to_char(ah.effective_start_date,'DD-MON-YYYY') transaction_date,
    to_char(nvl(i.payment_due_date,
    to_date('30-12-9999','dd-mm-yyyy')),'DD-MON-YYYY')
    due_date, ah.current_balance-ah.previous_balance amount,
    decode(ah.invoice_id,null,'A','I') transaction_type
    3 4 5 6 7 8 from account a,account_history ah,invoice i_+
    where a.account_id=ah.account_id
    and a.account_type_id=1000002
    and round(a.account_balance,2) > 0
    and (ah.invoice_id is not null or ah.adjustment_id is not null)
    and ah.CURRENT_BALANCE > ah.previous_balance
    and ah.invoice_id=i.invoice_id(+)
    AND a.account_balance > 0
    order by a.account_id,ah.effective_start_date desc; 9 10 11 12 13 14 15 16
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
    | 0 | SELECT STATEMENT | | 544K| 30M| | 693K (20)|
    | 1 | SORT ORDER BY | | 544K| 30M| 75M| 693K (20)|
    |* 2 | HASH JOIN | | 544K| 30M| | 689K (20)|
    |* 3 | TABLE ACCESS FULL | ACCOUNT | 20080 | 294K| | 6220 (18)|
    |* 4 | HASH JOIN OUTER | | 131M| 5532M| 5155M| 678K (20)|
    |* 5 | TABLE ACCESS FULL| ACCOUNT_HISTORY | 131M| 3646M| | 197K (25)|
    | 6 | TABLE ACCESS FULL| INVOICE | 262M| 3758M| | 306K (18)|
    Predicate Information (identified by operation id):
    2 - access("A"."ACCOUNT_ID"="AH"."ACCOUNT_ID")
    3 - filter("A"."ACCOUNT_TYPE_ID"=1000002 AND "A"."ACCOUNT_BALANCE">0 AND
    ROUND("A"."ACCOUNT_BALANCE",2)>0)
    4 - access("AH"."INVOICE_ID"="I"."INVOICE_ID"(+))
    5 - filter("AH"."CURRENT_BALANCE">"AH"."PREVIOUS_BALANCE" AND ("AH"."INVOICE_ID"
    IS NOT NULL OR "AH"."ADJUSTMENT_ID" IS NOT NULL))
    22 rows selected.
    Index Details:+_
    SQL> select INDEX_OWNER,INDEX_NAME,COLUMN_NAME,TABLE_NAME from dba_ind_columns where
    2 table_name in ('INVOICE','ACCOUNT','ACCOUNT_HISTORY') order by 4;
    INDEX_OWNER INDEX_NAME COLUMN_NAME TABLE_NAME
    OPS$SVM_SRV4 P_ACCOUNT ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME ACCOUNT_NAME ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT CUSTOMER_NODE_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT ACCOUNT_TYPE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_ACCOUNT_TYPE ACCOUNT_TYPE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_INVOICE INVOICE_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_PREVIOUS_INVOICE PREVIOUS_INVOICE_ID ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_NAME ACCOUNT
    OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 I_LAST_MODIFIED_ACCOUNT LAST_MODIFIED ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_INVOICE_ACCOUNT INVOICE_ACCOUNT_ID ACCOUNT
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT ACCOUNT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT SEQNR ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_INVOICE INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA CURRENT_BALANCE ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA INVOICE_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ACCOUNT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_LMOD LAST_MODIFIED ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_PAYMENT PAYMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADJUSTMENT ADJUSTMENT_ID ACCOUNT_HISTORY
    OPS$SVM_SRV4 I_ACCOUNT_HISTORY_APPLIED_DT APPLIED_DATE ACCOUNT_HISTORY
    OPS$SVM_SRV4 P_INVOICE INVOICE_ID INVOICE
    OPS$SVM_SRV4 U_INVOICE CUSTOMER_INVOICE_STR INVOICE
    OPS$SVM_SRV4 I_LAST_MODIFIED_INVOICE LAST_MODIFIED INVOICE
    OPS$SVM_SRV4 U_INVOICE_ACCOUNT ACCOUNT_ID INVOICE
    OPS$SVM_SRV4 U_INVOICE_ACCOUNT BILL_RUN_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_BILL_RUN BILL_RUN_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_INVOICE_TYPE INVOICE_TYPE_ID INVOICE
    OPS$SVM_SRV4 I_INVOICE_CUSTOMER_NODE CUSTOMER_NODE_ID INVOICE
    32 rows selected.
    Regards,
    Bathula
    Oracle-DBA

    I have some suggestions. But first, you realize that you have some redundant indexes, right? You have an index on account(account_name) and also account(account_name, account_id), and also account_history(invoice_id) and account_history(invoice_id, adjustment_id). No matter, I will suggest some new composite indexes.
    Also, you do not need two lines for these conditions:
    and round(a.account_balance, 2) > 0
    AND a.account_balance > 0
    You can just use: and a.account_balance >= 0.005
    So the formatted query isselect a.account_id,
           round(a.account_balance, 2) account_balance,
           nvl(ah.invoice_id, ah.adjustment_id) transaction_id,
           to_char(ah.effective_start_date, 'DD-MON-YYYY') transaction_date,
           to_char(nvl(i.payment_due_date, to_date('30-12-9999', 'dd-mm-yyyy')),
                   'DD-MON-YYYY') due_date,
           ah.current_balance - ah.previous_balance amount,
           decode(ah.invoice_id, null, 'A', 'I') transaction_type
      from account a, account_history ah, invoice i
    where a.account_id = ah.account_id
       and a.account_type_id = 1000002
       and (ah.invoice_id is not null or ah.adjustment_id is not null)
       and ah.CURRENT_BALANCE > ah.previous_balance
       and ah.invoice_id = i.invoice_id(+)
       AND a.account_balance >= .005
    order by a.account_id, ah.effective_start_date desc;You will probably want to select:
    1. From ACCOUNT first (your smaller table), for which you supply a literal on account_type_id. That should limit the accounts retrieved from ACCOUNT_HISTORY
    2. From ACCOUNT_HISTORY. We want to limit the records as much as possible on this table because of the outer join.
    3. INVOICE we want to access last because it seems to be least restricted, it is the biggest, and it has the outer join condition so it will manufacture rows to match as many rows as come back from account_history.
    Try the query above after creating the following composite indexes. The order of the columns is important:create index account_composite_i on account(account_type_id, account_balance, account_id);
    create index acct_history_comp_i on account_history(account_id, invoice_id, adjustment_id, current_balance, previous_balance, effective_start_date);
    create index invoice_composite_i on invoice(invoice_id, payment_due_date);All the columns used in the where clause will be indexed, in a logical order suited to the needs of the query. Plus each selected column is indexed as well so that we should not need to touch the tables at all to satisfy the query.
    Try the query after creating these indexes.
    A final suggestion is to try larger sort and hash area sizes and a manual workarea policy.alter session set workarea_size_policy = manual;
    alter session set sort_area_size = 2147483647;
    alter session set hash_area_size = 2147483647;

  • Using 2 BEx query structures - Not displaying as a hierarchy

    Gurus,
    I have CR2008, and I am using a BEx 7.0 query that has 2 structures.  One structure is key figures, the other is a layout that I turn on and display as a hierarchy.  There is cell definition behind the query.
    How can I get this second structure to view as a hierarchy in Crystal?  The cell definition is calculating correctly in Crystal, however all of the Profit Centers show on the same line, without indentation.
    If I create a Profit Center hierarchy in BW and bring it into Crystal, then I cannot use the cell definition, which is needed to calculate the correct results.
    Thanks in advance for responses.
    Scott Friery

    Help please!!  I really need some guidance for this problem?  Can I manually modify how the structure looks once I bring it into Crystal and drop into the "Details" section of the designer?
    The structure from the BEx query looks like this in Crystal:
    Global Sales
    Western Region Sales
    Location 1
    Location 2
    Location 3
    Eastern Region Sales
    Location 4
    Location 5
    Location 6
    I want the structure to look like this (and it does in the BEx 7.0 query designer)
    (No Indent) Global Sales
           (Indent 1 Space )Western Region Sales
              (Indent 2 spaces)  Location 1
              (Indent 2 Spaces) Location 2
              (Indent 2 Spaces) Location 3
           (Indent 1 Space) Eastern Region Sales
                (Indent 2 spaces) Location 4
                (Indent 2 spaces) Location 5
                (Indent 2 spaces) Location 6
    Any help is appreciated.
    Scott
    Edited by: Scott Friery on Feb 24, 2011 8:07 PM

Maybe you are looking for