OBIEE generated SQL differs if it's a Physical Table or Select Table...

Hi!
I have some tables defined in the Physical Layer, which some are Physical Tables and others are OBIEE "views" (tables created with a Select clause).
My problem is that the difference in the generated SQL for the same table, differs (as expected) whether it is a Physical Table or a "Select Table". And this difference originates problems in the returned data. When it a Physical Table, the final report returns the correct data, but when it is a Select Table it returns incorrect/incomplete data. The report joins this table with another table from a different Database (it is a join between Sybase IQ and SQL Server).
This is the generated SQL in the log:
-- Physical Table generated SQL
select T182880."sbl_cust_acct_row_id" as c1,
T182880."sbl_cust_acct_ext_key" as c2,
T182880."sbl_cust_source_sys" as c3
from
"SGC_X_KEY_ACCOUNT" T182880
order by c2, c3
-- "Select Table" generated SQL
select
     sbl_cust_acct_ext_key,
     ltrim(rtrim(sbl_cust_source_sys)) as sbl_cust_source_sys,
     sbl_cust_acct_row_id,
     sbl_cust_acct_camp_contact_row_id,
     ods_date,
     ods_batch_no,
     ods_timestamp
from dbo.SGC_X_KEY_ACCOUNT
As you may notice, the main difference is the use of Aliases (which I think that it has no influence in the report result) and the use of "Order By" (which I start to think that it its the main cause to return the correct data).
Don't forget that OBIEE server is joining the data from this table, with data from another table from a differente database. Therefore, the join is made in memory (OBIEE Engine). Maybe in the OBIEE Engine the Order by is essential to guarantee a correct join...but then again, I have some other tables in the Physical Layer that are defined as "Select" and the generated SQL uses the aliases and the Order by clause...
In order to solve my problem, I had to transform the "Select Table" into a "Physical Table". The reason it was defined as a "Select Table" was because it had a restriction in the Where Clause (which I eliminated already, althouth the performance wil be worse).
I'm confused. Help!
Thanks.
FPG

Hi FPG,
Not sure if this is a potential issue for you at all, but I know it caused me all kinds of headaches before I figured it out. Had to do with "Features" tab Values in the database object's settings in the Physical Layer:
Different SQL generated for physical table query vs. view object query?
Mine had to do with SQL from View objects not being submitted as I would expect, sounds like yours has more to do with "Order By"? I believe I remembered seeing some Order By and Group By settings in the "Features" list. You might make a copy of your RPD and experiement around with setting some of those if they aren't already selected and retesting your queries with the new DB settings.
Jeremy

Similar Messages

  • Entity Framework Generated SQL for paging or using Linq skip take causes full table scans.

    The slq genreated creates queries that cause a full table scan for pagination.  Is there any way to fix this?
    I am using
    ODP.NET ODTwithODAC1120320_32bit
    ASP.NET 4.5
    EF 5
    Oracle 11gR2
    This table has 2 million records. The further into the records you page the longer it takes.
    LINQ
    var cnt = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                        select errorLog).Count();
                    var query = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                                 orderby errorLog.ERR_LOG_ID
                                 select errorLog).Skip(cnt-10).Take(10).ToList();
    Here is the query & execution plans.
    SELECT *
    FROM   (SELECT "Extent1"."ERR_LOG_ID"  AS "ERR_LOG_ID",
                   "Extent1"."SRV_LOG_ID"  AS "SRV_LOG_ID",
                   "Extent1"."TS"          AS "TS",
                   "Extent1"."MSG"         AS "MSG",
                   "Extent1"."STACK_TRACE" AS "STACK_TRACE",
                   "Extent1"."MTD_NM"      AS "MTD_NM",
                   "Extent1"."PRM"         AS "PRM",
                   "Extent1"."INSN_ID"     AS "INSN_ID",
                   "Extent1"."TS_1"        AS "TS_1",
                   "Extent1"."LOG_ETRY"    AS "LOG_ETRY"
            FROM   (SELECT "Extent1"."ERR_LOG_ID"                                  AS "ERR_LOG_ID",
                           "Extent1"."SRV_LOG_ID"                                  AS "SRV_LOG_ID",
                           "Extent1"."TS"                                          AS "TS",
                           "Extent1"."MSG"                                         AS "MSG",
                           "Extent1"."STACK_TRACE"                                 AS "STACK_TRACE",
                           "Extent1"."MTD_NM"                                      AS "MTD_NM",
                           "Extent1"."PRM"                                         AS "PRM",
                           "Extent1"."INSN_ID"                                     AS "INSN_ID",
                           "Extent1"."TS_1"                                        AS "TS_1",
                           "Extent1"."LOG_ETRY"                                    AS "LOG_ETRY",
                           row_number() OVER (ORDER BY "Extent1"."ERR_LOG_ID" ASC) AS "row_number"
                    FROM   (SELECT "ERRORLOGANDSERVICELOG_VIEW"."ERR_LOG_ID"  AS "ERR_LOG_ID",
                                   "ERRORLOGANDSERVICELOG_VIEW"."SRV_LOG_ID"  AS "SRV_LOG_ID",
                                   "ERRORLOGANDSERVICELOG_VIEW"."TS"          AS "TS",
                                   "ERRORLOGANDSERVICELOG_VIEW"."MSG"         AS "MSG",
                                   "ERRORLOGANDSERVICELOG_VIEW"."STACK_TRACE" AS "STACK_TRACE",
                                   "ERRORLOGANDSERVICELOG_VIEW"."MTD_NM"      AS "MTD_NM",
                                   "ERRORLOGANDSERVICELOG_VIEW"."PRM"         AS "PRM",
                                   "ERRORLOGANDSERVICELOG_VIEW"."INSN_ID"     AS "INSN_ID",
                                   "ERRORLOGANDSERVICELOG_VIEW"."TS_1"        AS "TS_1",
                                   "ERRORLOGANDSERVICELOG_VIEW"."LOG_ETRY"    AS "LOG_ETRY"
                            FROM   "IDS_CORE"."ERRORLOGANDSERVICELOG_VIEW" "ERRORLOGANDSERVICELOG_VIEW") "Extent1") "Extent1"
            WHERE  ("Extent1"."row_number" > 1933849)
            ORDER  BY "Extent1"."ERR_LOG_ID" ASC)
    WHERE  (ROWNUM <= (10))
    | Id  | Operation              | Name                   | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |                        |    10 | 31750 |       |   821K  (1)| 02:44:15 |
    |*  1 |  COUNT STOPKEY         |                        |       |       |       |            |          |
    |   2 |   VIEW                 |                        |  1561K|  4728M|       |   821K  (1)| 02:44:15 |
    |*  3 |    VIEW                |                        |  1561K|  4748M|       |   821K  (1)| 02:44:15 |
    |   4 |     WINDOW SORT        |                        |  1561K|  3154M|  4066M|   821K  (1)| 02:44:15 |
    |*  5 |      HASH JOIN OUTER   |                        |  1561K|  3154M|       |   130K  (1)| 00:26:09 |
    |   6 |       TABLE ACCESS FULL| IDS_SERVICES_LOG       |  1047 | 52350 |       |     5   (0)| 00:00:01 |
    |   7 |       TABLE ACCESS FULL| IDS_SERVICES_ERROR_LOG |  1561K|  3080M|       |   130K  (1)| 00:26:08 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<=10)
       3 - filter("Extent1"."row_number">1933849)
       5 - access("T1"."SRV_LOG_ID"(+)="T2"."SRV_LOG_ID")

    I did try a sample from stack overflow that would apply it to all string types, but I didn't see any query results differences.  Please note, I am having the problem without any order with or where statements. Of course the skip take generates them.  Please advise how I would implement the EntityFunctions.AsNonUnicode method with this Linq query.
    LINQ
    var cnt = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                        select errorLog).Count();
                    var query = (from errorLog in ctx.ERRORLOGANDSERVICELOG_VIEW
                                 orderby errorLog.ERR_LOG_ID
                                 select errorLog).Skip(cnt-10).Take(10).ToList();
    This is what I inserted into my model to hopefully fix it.  FROM:c# - EF Code First - Globally set varchar mapping over nvarchar - Stack Overflow
    /// <summary>
    /// Change the "default" of all string properties for a given entity to varchar instead of nvarchar.
    /// </summary>
    /// <param name="modelBuilder"></param>
    /// <param name="entityType"></param>
    protected void SetAllStringPropertiesAsNonUnicode(
       DbModelBuilder modelBuilder,
       Type entityType)
       var stringProperties = entityType.GetProperties().Where(
      c => c.PropertyType == typeof(string)
       && c.PropertyType.IsPublic
       && c.

  • OBIEE 11g additional table in the generated sql

    Hi gurus,
    In OBIEE 11g RPD, we have a fact table whose source table is consisted by table A, B, C. Table A joins to table C while table B joins to tables C. And in the content tab, table C is used to filter out some records . If we select a column of A(The aggregation rule of this column is SUM) in the answers only, then table A, B, C are in the generated sql. If we remove the aggregation rule of this column, then there're only table A, C in the generated sql. We're wondering why this happened, but can't figure out.
    In this case, the relationship between table B and C is many to one. So additional table B in the generated sql may cause wrong sum. And we need the aggregation rule to sum the number. On the other hand, we can't remove the join between table B and C, since other reports need the join.
    Could anyone please provide a solution to remove the additional table B in the generated sql?
    Thanks & regards!
    shell

    Are you using in one report data from tables A, B, C at the same time? If not:
    1) Try separating the logical schema by:
    - Create an alias table for A and B in the physical layer. Then join these 2 tables. No create another Alias table for B (with a slightly different name) and one Alias table for C. Join these 2 tables (B+ and C)
    - Then put everything in your BMM and presentation layer.
    - Test your results. Take into account that if you are working with data in tables A and B you have to use the "fact table" B but if you use data in table C, use instead fact table from table B+.
    Your logical schema would be like A-->B B+-->C
    J.

  • OBIEE 11g "WITH SAWITH0 AS" subquery factoring clause in the generated sql

    I've observed that the OBIEE 11g generates in the query log physical query using the WITH (sub-query factoring) clause to make the generated sql elegantly readable. This is great! Thanks for the developers. However I have some questions about this.
    __Background__
    Oracle Database' default behaviour is that if you have only one sub-query in the WITH section, it executes it as an in-line view and does not materialize it before the main sql is executed. If you have more than one, by default the database engine materializes all of them in the order of the definition. In some cases this can completely blow up the SGA and make the query never ending. To divert this behaviour you can apply two hints that work both in inline views and in sub-queries as well: /*+ MATERIALIZE */ and /*+ INLINE*/, however Analytics 11g does not seem to have hint capabilities at the logical table level, only at physical table level.
    If we go with the current defaults, developers not aware of this feature can bump into serious performance issues for the sake of some syntax candy at the generated sql level, I'm afraid.
    __Questions__
    * Is it possible to turn the Analytics server not to use WITH but use inline views instead?
    * Is there any way to sneak in some hints that would put the /*+ INLINE */ hint to the appropriate place in the generated sub-queries if needed
    * Does the Oracle Database have any initialization parameter that can influence this sub-query factoring behavior and divert from the default?

    The WITH statement is not added to make the query more elegant, it's added for performance reasons. If your queries take long to run then you may have a design issue. In a typical DWH DB SGA needs to be seriously increased since the queries ran are much larger and complex than on an OLTP DB. In any case you can disable the WITH statement in the Admin Tool by double clicking on your database object on the physical layer and going to the Features tab. The feature is called WITH_CLAUSE_SUPPORTED.

  • OBIEE generates broken SQL

    Dear guru.
    Let me know what's may be wrong ?
    My post is closely related to bad SQL thread.
    Shortly speaking, I'd like to discuss multiple star problem.
    So, Oracle Business Intelligence 11.1.1.6.0
    I have three fact table A,B,C joined to common link table D ( look as dimension in Administrator )
    A and B have inner join with D, while C has left outer join to D ( actually outer join defined only in BMM cause don't see how set outer join on physical layer for C ).
    The matter is in generated SQL query which is broken, i.e. can't be compiled in Oracle DB.
    Let me give broken piece of generated SQL.
    As you can see, the subquery has reference to table T69242 in WHERE, but no such table in FROM section:
    SACOMMON821644 AS
    (SELECT
    /*+ MATERIALIZE */
    DISTINCT T68993.NAME AS c1,
    T69266.DISTRICT2 AS c2,
    CASE
    WHEN T68993.DEPARTMENTID IN
    (SELECT D1.c1 AS c1 FROM SASUBWITH820608 D1
    THEN 1
    ELSE 0
    END AS c3,
    CASE
    WHEN T69266.OKATO_KOD IN
    (SELECT D1.c1 AS c1
    FROM SASUBWITH820633 D1
    THEN 1
    ELSE 0
    END AS c4,
    T68993.DEPARTMENTID AS c5,
    T69266.OKATO_KOD AS c6,
    T68993.PARENT AS c7,
    T69266.PARENT_OKATO_KOD AS c8
    FROM BI_MSK_DISTRICTS_STAT_HIER T69233
    MOS_DISTRICTS_STAT T69266
    BI_DEPARTMENTS_MFC T68993
    BI_MFC_HIER T69068
    DEP_OPERATORS_CNT T69220
    INCIDENTS T69648
    MOS_DISTRICT_POPULATION T69410
    WHERE ( T69233.MEMBER_KEY = T69410.OKATO_KOD
    AND T68993.DEPARTMENTID = T69068.ANCESTOR_KEY
    AND T69068.MEMBER_KEY = T69220.DEPARTMENTID
    AND T69220.DEPARTMENTID = T69242.DEPARTMENTID*
    AND T69233.ANCESTOR_KEY = T69266.OKATO_KOD
    AND T69242.OKATO_KOD* = T69410.OKATO_KOD
    AND T68993.DEPARTMENTID IN
    (SELECT D1.c1 AS c1 FROM SASUBWITH820658 D1
    AND T69266.OKATO_KOD IN
    (SELECT D1.c1 AS c1 FROM SASUBWITH820683 D1
    Meanwhile in aggregation subquery of that generated SQL we have requred table
    SACOMMON821667 AS
    (SELECT
    /*+ MATERIALIZE */
    TRUNC(SUM( DISTINCT T69220.OPER_TOTAL)) AS c9,
    T68993.DEPARTMENTID AS c10,
    T68993.PARENT AS c11,
    T69266.OKATO_KOD AS c12,
    T69266.PARENT_OKATO_KOD AS c13,
    SUM( DISTINCT T69410.POPUL_SIZE) AS c14,
    SUM(T69648.TOTAL / NULLIF( T69242.OKATO_COUNT, 0)) AS c15
    FROM BI_MSK_DISTRICTS_STAT_HIER T69233
    MOS_DISTRICTS_STAT T69266
    BI_DEPARTMENTS_MFC T68993
    BI_MFC_HIER T69068
    DEP_OPERATORS_CNT T69220
    MFC_ADDRESSOKATO T69242*
    LEFT OUTER JOIN INCIDENTS T69648
    ON T69242.DEPARTMENTID = T69648.DEPARTMENTIDFROM,
    MOS_DISTRICT_POPULATION T69410
    WHERE ( T69242.OKATO_KOD = T69410.OKATO_KOD
    AND T69233.ANCESTOR_KEY = T69266.OKATO_KOD
    AND T69233.MEMBER_KEY = T69410.OKATO_KOD
    AND T69220.DEPARTMENTID = T69242.DEPARTMENTID
    AND T68993.DEPARTMENTID = T69068.ANCESTOR_KEY
    AND T69068.MEMBER_KEY = T69220.DEPARTMENTID
    AND T68993.DEPARTMENTID IN
    (SELECT D1.c1 AS c1 FROM SASUBWITH820658 D1
    AND T69266.OKATO_KOD IN
    (SELECT D1.c1 AS c1 FROM SASUBWITH820683 D1
    GROUP BY T68993.DEPARTMENTID,
    T68993.PARENT,
    T69266.OKATO_KOD,
    T69266.PARENT_OKATO_KOD
    And it's time to show Consistency Check results in Administrator.
    There is no errors, but
    WARNINGS:
    Business Model Сводная таблица:
    [39008] Logical dimension table A_MFC_ADDRESSOKATO has a source A_MFC_ADDRESSOKATO that does not join to any fact source.
    [39020] Logical table source "Сводная таблица"."FCT Incidents"."A_Incidents": No path has been found to link all tables. There is no link between the set ( 'A_DEP_OPERATORS_CNT', 'A_MFC_ADDRESSOKATO', 'A_MOS_DISTRICT_POPULATION' ) and the set ( 'A_Incidents' ).
    [39020] Logical table source "Сводная таблица"."A_DEP_OPERATORS_CNT"."A_DEP_OPERATORS_CNT ": No path has been found to link all tables. There is no link between the set ( ) and the set ( ).
    [39020] Logical table source "Сводная таблица"."A_MOS_DISTRICT_POPULATION"."A_MOS_DISTRICT_POPULATION": No path has been found to link all tables. There is no link between the set ( ) and the set ( ).
    I wonder, how that link can be realized, when fact tables already have joins to common dim A_MFC_ADDRESSOKATO.
    Should I create Logical Dimmension for A_MFC_ADDRESSOKATO while it is actually bridge table in terms of 10G ?
    Besides, as we can see from query, A B and C have its own dims.
    So, finally as a result in Answers we have
    ORA-00904: "T69242"."OKATO_KOD": invalid identifier at OCI call OCIStmtExecute
    It should be mentioned that error is appeared only when I put measure from A_Incidents (C alias) on analys in Answers, till that all worked correctly, i.e. A,B joined successfully to D
    and SQL query gave desired result.
    Any suggestion on issue are greately appreciated.
    Sorry for unformatted SQL, still don't know how to do it.
    Hope, my explanation was clear.

    Seems to be bug.
    OBIEE can't generate correct SQL when outer join used

  • Generated SQL query question

    In my OBIEE development environment, a report I create in Answers generates the following SQL query to the database:
    select T29323.LOCATION as c1,
    T29323.TOOL_NAME as c2,
    T29323.JOB_NUMBER as c3,
    from
    EDB.EDB_JOB_NUMBER_PARAMETER_T_V T29323
    where
    ( T29323.JOB_NUMBER = 1319511
    and T29323.CREATION_DATE <= TO_DATE('2008-05-21 08:38:18' , 'YYYY-MM-DD HH24:MI:SS')
    and (T29323.LOCATION in ('MOO', 'RR'))
    and T29323.CREATION_DATE >= TO_DATE('2008-05-18 08:38:18' , 'YYYY-MM-DD HH24:MI:SS'))
    However, in my OBIEE Production environment the same report generates the following SQL query to the database;
    select D1.c12 as c1,
    D1.c11 as c2,
    D1.c10 as c3
    from
    (select T29323.JOB_NUMBER as c10,
    T29323.TOOL_NAME as c11,
    T29323.LOCATION as c12
    from
    EDB.EDB_JOB_NUMBER_PARAMETER_T_V T29323
    where ( T29323.JOB_NUMBER = 1319511
    and T29323.CREATION_DATE <= TO_DATE('2008-05-21 09:19:03' , 'YYYY-MM-DD HH24:MI:SS')
    and (T29323.LOCATION in ('MOO', 'RR'))
    and T29323.CREATION_DATE >= TO_DATE('2008-05-18 09:19:03' , 'YYYY-MM-DD HH24:MI:SS'))
    ) D1
    Any ideas why the queries are different? I have looked through my config files to see if a setting is different, but all are the same.
    I am running OBIEE 10.1.3.3.2
    Any suggestions would be appreciated.
    Thanks,
    Kevin

    Hi Kevin,
    I have the same problem with generated SQL querys, I get different result with the same repository, same query in Answers, same OS... in several environments.
    The BI vesion is 10.1.3.4
    Any idea about the question?
    Regards
    Guillermo

  • OBIEE: Incorrect SQL - with count function uses ORDER BY instead GROUP BY

    I made a basic report that is a client count; I want to know how many clients the company have.
    But, when I run this report, OBIEE generates a ORDER BY sentence, instead a GROUP BY. Remember that I'm using count function, that is a agregation.
    The SQL generated was:
    select 'N0' as c1,
    count(*) as c2
    from
    (select distinct T1416.CLIENT_INTER_KEY as c1
    from
    (select *
    from prd.D_SERVICE where SOURCE_SYS in ('ARBOR','PPB') and DW_SERV_ST_ID in (100000003,100000009)) T1836,
    (select *
    from prd.D_CLIENT) T1416,
    (select *
    from prd.D_CUSTOMER_ACCOUNT where SOURCE_SYS In ('ARBOR','PPB')) T1515
    where ( T1416.DW_CLIENT_ID = T1515.DW_CLIENT_ID and T1515.DW_CUST_ACCT_ID = T1836.DW_CUST_ACCT_ID and T1836.MSISDN = '917330340' )
    ) D1
    order by c1
    The error that I receive is:
    "Query Status: Query Failed: [nQSError: 16001] ODBC error state: S1000 code: -1005018 message: [Sybase][ODBC Driver][Adaptive Server Anywhere]Illegal ORDER BY item Order Item: 'N0',
    -- (opt_OrderBy.cxx 429) .
    [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement."
    If I substitute ORDER BY with GROUP BY and test it in Sybase, Ithe query runs without any problem.
    select 'N0' as c1,
    count(*) as c2
    from
    (select distinct T1416.CLIENT_INTER_KEY as c1
    from
    (select *
    from prd.D_SERVICE where SOURCE_SYS in ('ARBOR','PPB') and DW_SERV_ST_ID in (100000003,100000009)) T1836,
    (select *
    from prd.D_CLIENT) T1416,
    (select *
    from prd.D_CUSTOMER_ACCOUNT where SOURCE_SYS In ('ARBOR','PPB')) T1515
    where ( T1416.DW_CLIENT_ID = T1515.DW_CLIENT_ID and T1515.DW_CUST_ACCT_ID = T1836.DW_CUST_ACCT_ID and T1836.MSISDN = '917330340' )
    ) D1
    group by c1
    Do you know why OBIEE generates this SQL??? Why uses, with a aggregation function, a ORDER BY and not a GROUP BY? How can I resolve this problem???
    Regards,
    Susana Figueiredo

    Verify your repository design and make sure that you have defined count aggregate on fact column. You would also need to define the content level of each dimension in fact table.

  • Generating SQL SELECT statement with Schema

    I develop a 3rd-party application that connects to various
    databases via ODBC. Our program generates the SQL statement
    so that the user does not have to. When connecting to oracle the
    user often gets the error message: ORA-00942: table or view does
    not exist.
    To work around this our tech support department has tells the
    customer to enter in the Schema name before the table name.
    Thus,
    SELECT ItemNo from Item
    becomes
    SELECT ItemNo from MySchema.Item
    Is there a way that I can query the Data Source to find out
    the Schema name so that our program can put in in the
    statement. Is there a SQLGetInfo call I can make to get
    this information?
    Or, should I have the Server specified in the connection
    string? For SQL Server we use SQLGetPrivateProfileString to
    obtain the server name and then include it in the connection
    string: SRVR=<servername>
    Unfortunately, if this is the case the keyword is different
    depending on the ODBC Driver involved. "Server" for Microsoft.
    "SRVR" for Intersolv. "ServerName" for Oracle.
    Note: We do not have Oracle in-house to test with. I'm
    wondering if we could get Oracle for free for development
    purposes.
    Any and all information would be greatly appreciated.

    Thanks for the tip. I just finished downloading Oracle.
    One user is able to successfully view the database with the
    statement:
    SELECT ItemNo from Item
    But if another user tries it he gets the "table or view not
    found" message. Changing the statement as follows will allow
    the 2nd user to view the database:
    SELECT ItemNo from "MAXIMO".Item
    I want my application to query the database via ODBC for the
    "MAXIMO" string so I can create the correct SQL statement.
    Thanks!
    <<Are you trying to view tables from a non-default schema?>>I don't know. You would know better than me from my
    description.

  • OBIEE generates complex queries

    Hi,
    Currently we are experiencing performance issues, i.e. some queries are running for a very long time. I examined these queries and it struck me that it could be caused by the complexity of the generated queries. For example, a query accessing only one facttable accessed that facttable 5 times (the queries are concatenated through the WITH statement) ! I wonder, why is this necessary? Business Objects XI does not generate such complex queries, BO XI would access that facttable only one time.
    Basically my question is: which settings affect the queries generated by OBIEE? Isn't it possible to generate different, simpler queries?
    TIA,
    EriK

    Thanks guys. Bad design could be a reason.. but we're using Oracle's own product called BI-APPS and I expect that to be perfect...:-)
    Here is an example of a query that is imho way too complex:
    WITH
    SAWITH0 AS (select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
    T551303.PROJECT_NUMBER as c2,
    T258218.PURCH_ORDER_NUM as c3
    from
    W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
    W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
    where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
    group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER),
    SAWITH1 AS (select distinct SAWITH0.c2 as c1,
    SAWITH0.c3 as c2,
    SAWITH0.c1 as c3,
    SAWITH0.c1 as c4,
    SAWITH0.c1 as c5
    from
    SAWITH0),
    SAWITH2 AS (select distinct SAWITH1.c1 as c1,
    SAWITH1.c2 as c2,
    SAWITH1.c3 as c3
    from
    SAWITH1),
    SAWITH3 AS (select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
    T551303.PROJECT_NUMBER as c2,
    T258218.PURCH_ORDER_NUM as c3
    from
    W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
    W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
    where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
    group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER),
    SAWITH4 AS (select distinct SAWITH3.c2 as c1,
    SAWITH3.c3 as c2,
    SAWITH3.c1 as c3,
    SAWITH3.c1 as c4,
    SAWITH3.c1 as c5
    from
    SAWITH3),
    SAWITH5 AS (select sum(SAWITH4.c4) as c4,
    SAWITH4.c1 as c5
    from
    SAWITH4
    group by SAWITH4.c1),
    SAWITH6 AS (select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
    T551303.PROJECT_NUMBER as c2,
    T258218.PURCH_ORDER_NUM as c3
    from
    W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
    W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
    where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
    group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER),
    SAWITH7 AS (select distinct SAWITH6.c2 as c1,
    SAWITH6.c3 as c2,
    SAWITH6.c1 as c3,
    SAWITH6.c1 as c4,
    SAWITH6.c1 as c5
    from
    SAWITH6),
    SAWITH8 AS (select sum(SAWITH7.c5) as c3
    from
    SAWITH7)
    select SAWITH2.c1 as c1,
    SAWITH2.c2 as c2,
    SAWITH2.c3 as c3,
    SAWITH5.c4 as c4,
    SAWITH8.c3 as c5
    from
    SAWITH2,
    SAWITH5,
    SAWITH8
    where ( nvl(SAWITH2.c1 , 'q') = nvl(SAWITH5.c5 , 'q') and nvl(SAWITH2.c1 , 'z') = nvl(SAWITH5.c5 , 'z') )
    Basically the query is:
    select sum(T258218.LINE_AMT * T258218.GLOBAL1_EXCHANGE_RATE) as c1,
    T551303.PROJECT_NUMBER as c2,
    T258218.PURCH_ORDER_NUM as c3
    from
    W_PROJECT_D T551303 /* Dim_W_PROJECT_D_Project */ ,
    W_PURCH_COST_F T258218 /* Fact_W_PURCH_COST_F */
    where ( T258218.DELETE_FLG = 'N' and T258218.PROJECT_WID = T551303.ROW_WID and T551303.PROJECT_NUMBER = '101491' )
    group by T258218.PURCH_ORDER_NUM, T551303.PROJECT_NUMBER
    but this query is repeated multiple times. It looks like a self join - but why is OBIEE generating such a complex query? And can it be affected?
    Edited by: user10984315 on 18-Mar-2011 08:29
    Edited by: user10984315 on 18-Mar-2011 08:30

  • Error: while generating SQL.java.rmi.ServerException:

    Hi:
    I tried the JGuru's "MusicStore" example. HOwever at Task 6 and 7 I am getting the following error:
    Error: while generating SQL.java.rmi.ServerException:
    RemoteException occured in server thread; nested exception is:
    * java.rmi.RemoteException: Error connecting to database;
    nested exception is:
    * SQL Exception: Failed to start database 'MusicStoreDB', see
    the next exception for details.
    Please make sure the database name/user/password is valid
    and the J2ee server and database are running.
    However when i check my database it is running perfectly:
    E:\>%j2ee_home%\bin\cloudscape -start
    Sun Feb 16 12:48:11 PST 2003: [RmiJdbc] Starting Cloudscape RmiJdbc Server Version
    Sun Feb 16 12:48:14 PST 2003: [RmiJdbc] COM.cloudscape.core.JDBCDriver registered i
    Sun Feb 16 12:48:14 PST 2003: [RmiJdbc] Binding RmiJdbcServer...
    Sun Feb 16 12:48:14 PST 2003: [RmiJdbc] No installation of RMI Security Manager...
    Sun Feb 16 12:48:14 PST 2003: [RmiJdbc] RmiJdbcServer bound in rmi registry
    Server:
    J2EE server listen port: 1050
    Naming service started:1050
    Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
    te=true
    Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
    DB;create=true
    Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:Cloudscap
    eDB;create=true
    Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
    te=true
    Binding DataSource, name = jdbc/MusicStore, url = jdbc:cloudscape:rmi:MusicStore
    DB;create=false
    Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
    Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.co
    re.RemoteXaDataSource@1d88db7
    Starting JMS service...
    Initialization complete - waiting for client requests
    Binding: < JMS Destination : jms/Topic , javax.jms.Topic >
    Binding: < JMS Destination : jms/Queue , javax.jms.Queue >
    Binding: < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
    Binding: < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
    Binding: < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties
    >
    Binding: < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties
    >
    Starting web service at port: 8000
    Starting secure web service at port: 7000
    J2EE SDK/1.3.1
    Starting web service at port: 9191
    J2EE SDK/1.3.1
    J2EE server startup complete.
    Can anyone suggest me a way out..plz

    what type of persistent u r using also post ur query if bmp and check with another example with cmp.

  • How can I Generate two different reports from single execution of Test cases in NI teststand

    Hi,
    My requirement is to generate two different reports from NI teststand. One for the Logging of error descriptions and the other report is by default generated by the Teststand. How can i generate a txt file that contains error descriptions other than that mentioned in the default report?
    Solved!
    Go to Solution.

    Do you need to do that just for these two sequences but not for other sequences? I don't see a problem to use SequenceFilePostStepRuntimeError. Create this callback in both sequence files and configure them to log into the same file. SequenceFilePostStepRuntimeError callback is called after each step of the sequence file if it has runtime error. You can access the calling step error information via RunState.Caller.Step.Result.Error property. Take a look to attached example.
    The "other way" is useful if you need to log errors not for every step of the sequence file, but for some of them. This is more complex, because you need to create a custom step types for these steps. For the custom step you can create substeps (post-step in your case) which will be executed every time after step of this type executed. Then, this is you job to determine if error happened in the step, acces to step's error information is via Step.Result.Error property. 
    Also, be aware that step's post-expression is not executed in case of error in the step.
    Sergey Kolbunov
    CLA, CTD
    Attachments:
    SequenceFilePostStepRuntimeError_Demo.seq ‏7 KB

  • Weird behavior: PLSQL-generated SQL Report Region

    I am trying to tune my PLSQL-generated SQL Report Region. I put in some code to write the resulting query to a table. I turn it on, run the page, and then turn it off and look at the SQL. Instead of getting one query for each time I load the page, I get five. Trying to find out a bit more about why, I concatenate :APP_USER and to_char(sysdate, 'hh:mi:ss') to the resulting SQL. What I find is that four of the entries in the table have my ApEx dev username, and all of these writes are 3 seconds before the SQL generated under the app username is written!
    It probably goes without saying, but in all of the writes under my dev username, there are no session values and so any PLSQL if statements that depend on a session value act as if the session values are null. Also, any place I have :APP_ID show up as 4000 in those writes instead of the app number that shows up under my app username.
    Do you follow this?
    Well, on a hunch I copied the whole region back on to the page and disabled the original. This time, no writes with the dev username, only one select statement as originally expected.
    Is that wierd or what?
    Bill

    Scott, Your last comment - that was it. I should've paid more attention to the time. The minutes must have been off. I made sure to log out of the dev environment before I ran the page, but the writes under my dev login were occurring when I saved the region. I still don't see why that process causes four identical writes, but it's not that important.
    Thanks! Now I can to working on the real problem - improving my SQL.
    Bill

  • Generating SQL in a PL/SQL progam ( getting the values of a value)

    Hi,
    We're using Oracle 11.1.
    I want to generate sql to do the following
    something like
    fld_pos(i) = 'MPI';Where fld_pos is part of a varray.
    The basic procedire is below.
    PROCEDURE get_oldest_mpi (
          pin_fld0 VARCHAR2
        , pin_fld1 VARCHAR2
        , pin_fld2 VARCHAR2
        , pin_fld3 VARCHAR2
        , pin_fld4 VARCHAR2
        , pin_fld5 VARCHAR2
        , pin_fld6 VARCHAR2
        , pin_fld7 VARCHAR2
        , pin_fld8 VARCHAR2
        , pin_fld9 VARCHAR2
        , pin_fld10 VARCHAR2
        , pin_fld11 VARCHAR2
        , pin_fld12 VARCHAR2
        , pin_fld13 VARCHAR2
    IS
         TYPE fld IS VARRAY(14) OF VARCHAR2(50);
         fld_pos fld;
         v_sql_stmt VARCHAR2(1000);
         mpi_pos  number;
    BEGIN
    --load the pin_fld vars into an array so they can be processed in a loop
        FOR i IN 1..fld_pos.COUNT
        LOOP
        fld_pos(i) := 'pin_fld'||i;
        END LOOP;
    --see if the variable pin_fld'x' = the word 'MPI'
        FOR i IN 1..fld_pos.COUNT
        LOOP
        IF  fld_pos(i) = 'MPI' then    -- I know this statement is wrong. This is where I need help.
          mpi_pos :=i;
        END IF;
        END LOOP;
    .I know that 'fld_pos(i)' equals 'pin_fld||i .
    So how do I get to the value in the value for this? How can generate the SQL to get the expression I need?
    Thanks,

    Hi,
    It's still an awkward procedure, but
    CREATE OR REPLACE PROCEDURE get_oldest_mpi (
      pin_fld0     VARCHAR2,
      pin_fld1     VARCHAR2,
      pin_fld2     VARCHAR2,
      pin_fld3     VARCHAR2,
      pin_fld4     VARCHAR2,
      pin_fld5     VARCHAR2,
      pin_fld6     VARCHAR2,
      pin_fld7     VARCHAR2,
      pin_fld8     VARCHAR2,
      pin_fld9     VARCHAR2,
      pin_fld10    VARCHAR2,
      pin_fld11    VARCHAR2,
      pin_fld12    VARCHAR2,
      pin_fld13    VARCHAR2
    ) IS
      TYPE fld IS VARRAY (14) OF VARCHAR2 (50);
      fld_pos      fld
                     := fld (pin_fld0,
                             pin_fld1,
                             pin_fld2,
                             pin_fld3,
                             pin_fld4,
                             pin_fld5,
                             pin_fld6,
                             pin_fld7,
                             pin_fld8,
                             pin_fld9,
                             pin_fld10,
                             pin_fld11,
                             pin_fld12,
                             pin_fld13
      v_sql_stmt   VARCHAR2 (1000);
      mpi_pos      NUMBER;
    BEGIN
      --see if the variable pin_fld'x' = the word 'MPI'
      FOR i IN 1 .. fld_pos.COUNT LOOP
        IF fld_pos (i) = 'MPI' THEN
          mpi_pos := i;
        END IF;
      END LOOP;
    END;
    /Regards
    Peter

  • To generate sql string of desired row  using function.

    Hi l,
    I return the below query to get sum of vehicles which falls between the specific weight ranges.
    It returns 20 rows( As I selected 4 classification vehicles).I was expect only 4 rows .One row for each classification of vehicles.
    Is there a way if do some loop or decode in my function logic?
    will tht work?
    "(This is only smple. In my real appilication, if I use 15 classification vehicles it returns 320 rows. But i expect only 16 rows - 0 to 15 one row for each classification .Duirng runtime I'm getting an error as buffer string too small)"
    How could I solve this?
    I use this query inside a function and I call that function in a dynamic sql.
    SELECT 'SUM('
        || 'CASE '
        || 'WHEN weight_report_data.weight >=  '|| repo_range_param.min_value ||' 
            AND weight_report_data.weight   <       repo_range_param.max_value
            THEN weight_report_data.weight_count '   
        || 'ELSE 0 '
        || 'END '
        || ') "Class ' || repo_param.r_value || '" '   
          FROM repo_param
          JOIN repo_range_param
            ON repo_param.r_id = repo_range_param.r_id
         WHERE repo_param.r_id    = 1
           AND repo_param.r_group = 'class'
           AND repo_param.r_name  = 'class'
           AND repo_range_param.r_group = 'gvw'
           AND repo_range_param.r_name  = 'gvw'
         ORDER BY CAST(repo_param.r_value AS NUMBER) ASC;
    "sample sql string output when I run the above query "
    SUM(CASE WHEN weight_report_data.weight >=10
             AND weight_report_data.weight  <15
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 0"
    SUM(CASE WHEN weight_report_data.weight >=15
             AND weight_report_data.weight  <20
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 1"
    SUM(CASE WHEN weight_report_data.weight >=5
             AND weight_report_data.weight  <10
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 2"
    SUM(CASE WHEN weight_report_data.weight >=20
             AND weight_report_data.weight  <25
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 3"
    "sample data for the tables involved"
    CREATE  TABLE weight_report_data
    start_date_time       TIMESTAMP      NOT NULL,
    end_date_time         TIMESTAMP      NOT NULL,
    weight                NUMBER(12,0)   NOT NULL,
    weight_count          NUMBER(12,0)   NOT NULL
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',4,5);
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',3,1);
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',8,6);
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',25,9);
    CREATE  TABLE repo_param
    R_ID       NUMBER(12,0),
    R_GROUP     VARCHAR2(10),
    R_NAME     VARCHAR2(10),
    R_VALUE     VARCHAR2(10)
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',0);
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',1);
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',2);
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',3);
    CREATE  TABLE repo_range_param
    R_ID       NUMBER(12,0),
    R_GROUP     VARCHAR2(10),
    R_NAME     VARCHAR2(10),
    MIN_VALUE NUMBER(3,0),
    MAX_VALUE     NUMBER(3,0)
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',0,5);
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',5,10);
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',10,15);
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',15,20);
           INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',20,25);
    Thanks in advance
    Edited by: user10641405 on Jun 18, 2009 4:10 PM
    Edited by: user10641405 on Jun 18, 2009 4:15 PM
    Edited by: user10641405 on Jun 18, 2009 4:15 PM
    Edited by: user10641405 on Jun 18, 2009 4:16 PM
    Edited by: user10641405 on Jun 18, 2009 4:17 PM
    Edited by: user10641405 on Jun 18, 2009 7:47 PM
    Edited by: user10641405 on Jun 19, 2009 4:15 PM

    Say you have a 3 tables
    Table name Description rowcount()
    ============================================================================
    weight_report_data report table having weights and counts 4
    repo_param having id column gives different classes 4
    repo_range_param is detail table of repo_param with id 4
              as foreign key and defines weight
              min max ranges.
    Now you need to report
    per class how many weights weights are there ?
    --not understood report id clearly in relation to weight_report_data
    step1:
    need to map each row of weight_report_data againist its class.
    select wrd.weight,wrd.weight_count,(select rp.class||rp.value
    from repo_range_param rrp,
              repo_param rp
    where rrp.id= rp.id
    and rp.id=1 -- add your other join condition
    and wrd.weight between rrp.min and rrp.max ) class_nm
    from weight_report_data wrd ;
    This will give 4 rows , i.e for each row in wrd it tells which class it falls.
    now you want to group by class_nm to get sum or count of weights.
    step2:
    select class_nm,sum(weight), count(weight), sum(weight_count)
    from (
    select wrd.weight,wrd.weight_count,(select rp.class||rp.value
    from repo_range_param rrp,
              repo_param rp
    where rrp.id= rp.id
    and rp.id=1 -- add your other join condition
    and wrd.weight between rrp.min and rrp.max ) class_nm
    from weight_report_data wrd ) wrd_classnm
    group by class_nm;
    I hope this helps .
    suggestion: first analyse and breakdown into stpes how you r going to do if you do by hand and then translate into sql and then optimise

  • How Can I generate 2 different WaveForm in the same time

    Hello,
    I use a NI 6733 card and measurement studio 8 with MFC class.
    I would like to generate 2 different waveform in the same time on 2 diffrent analog output channel.
    I would like to know how can i do that bescause I succeed to generate one wafeform on one channel but not the second.
    I would like to create 2 task one per analog output channel and waveform and launch the task in the same time.
    I use the buffer FIFO and I think I have a probleme to share the buffer between the to different channel.
    thank you for your attention.

    Hello,
    This corresponds of the third case detailed in this KnowledgeBase. You have to use one task with two channel, and feed it with your two independant waveforms (at the same sampling rate).
    Cordially,
    .mrLeft{float:left} .mrInfo{border-left:solid 1px #989898;font-size:x-small;color:#989898}
    Mathieu R.  
      CTD - Certified TestStand Developer / Développeur TestStand Certifié  
      CLAD - Certified LabVIEW Associate Developer  

Maybe you are looking for

  • How to select One Check Box at a time

    Dear All I have 10 records in details blok and also I have 10 check boxes . I want user can only check one check box at a time . For example If first record I have checked and i am trying to check the last record then the first record UNCHECKED and t

  • T500 wont shut down

    Hello there ! We have big problems with our Lenovo T500 model 2241 CTO. We are running Windows Vista on them. The problem is when we are shutting down, they mostly dont shut off correctly. It seem that windows are shutting down, but when the screen t

  • Select more than one item in a SUD listbox?

    Is there a way to select more than one item in a listbox in a SUD? I can't find anything in the properties relating to that. I want to be able to select one or more items in a listbox just like I can in LabVIEW. George

  • Caching Projection Queries

    Does Kodo cache projection queries? All my queries are caching properly, except for ones that use setResult(), and I'd like them to be cached also. Here's an example: PersistenceManager pm = getPM(); extent = pm.getExtent(ConstellationRevenueDAO.clas

  • Author field inherit problem from Folder to Asset check in page

    Hi, Please let me know how to restrict "Author" field value inheriting from Folder level check in form to Asset level check in form while uploading a asset to the previously created folder. My system(UCM server) will inherit the Author value existed