Caching in report query

I have 2 questions.
1. Theres is cacheQueryResults() method in ReportQuery class. The javadoc says that "This method will instruct the query to cache the results returned by its next execution. All subsequent executions of this query will return this cached result set even if new query parameters are specified."
Does it mean that If I query using ReportQuery, & set cacheQueryResults(), query results will be cached?
e.g. if there is a method getEmployees() which uses ReportQuery to get data from database. If application makes repeated calls to getEmployees() method, will it result in database calls or will it return results from cache?
2. Can I use parallel expression & subquery in ReadObjectQuery/ReadAllQuery?
Any help is highly appreciated.

Answered Re: Toplink: Report query
Doug

Similar Messages

  • Report query

    hi i have one matrix report which displays the information about gl je lines amount for the consolidation setofbooks.
    Report is having 2 parameters.
    1: set of books name
    2: run date
    i have derived chart of accounts id from given sob name in formula column and passing it into the query.
    we have 1 consolidation sob and some reporting sobs to this sob.
    some of these reprting sobs are consolidation sobs for some other reporting sobs.
    now the req is if user gives sob name of main consolidation book then it should display the amount and sob ids in their reporting sobs currency like for india it should display INR and italy Euro and USD for US.
    I have done this by using some join to the consolidation and i am getting the reqd info for this.
    the join is
    cc -->gl_code_combinations
    h--> gl_je_headers
    l-->gl_je_lines
    gsb-->gl_sets_of_books
    gc1 and gc2 are gl_consolidation tables.
    where
    to_number_no_null(cc.segment4) < 700000 and
    cc.code_combination_id = l.code_combination_id
    and cc.chart_of_accounts_id = 50135
    and h.je_header_id = l.je_header_id
    and h.actual_flag = 'A'
    and nvl(h.CURRENCY_CODE,'XXX') != 'STAT'
    and l.set_of_books_id = gsb.SET_OF_BOOKS_ID
    and gsb.SET_OF_BOOKS_ID=gc1.FROM_SET_OF_BOOKS_ID
    and gc1.TO_SET_OF_BOOKS_ID=gc2.FROM_SET_OF_BOOKS_ID
    and gc2.TO_SET_OF_BOOKS_ID= 47
    and l.status = 'P'
    and nvl(l.effective_date,sysdate) <= last_day(sysdate)
    group by cc.segment3,
    cc.segment4,
    cc.segment5,
    to_char(trunc(to_date(sysdate,'DD-MON-RR')), 'MON-YY'),
    gsb.SET_OF_BOOKS_ID ,
    gsb.CURRENCY_CODE
    having sum( nvl(accounted_dr,0) - nvl(accounted_cr,0) ) <> 0
    if we observe the join of this and assume the values
    and l.set_of_books_id = gsb.SET_OF_BOOKS_ID--21
    and gsb.SET_OF_BOOKS_ID=gc1.FROM_SET_OF_BOOKS_ID--from sob(reporting sob) 21 reporting to 46
    and gc1.TO_SET_OF_BOOKS_ID=gc2.FROM_SET_OF_BOOKS_ID--from sob(reporting sob) 46 reporting to 47
    and gc2.TO_SET_OF_BOOKS_ID= 47--main sob from user parameter
    but problem is for 47 we have 2 reporting sobs are 46 and other is 1
    46 is having reporting sobs ut 1 does not have any reporting sobs so i am missing the data of 1.
    could you please suggest me how do i get these to sobs values.
    now i have these 2 values 46 and 1 in future i may have more reporting sobs and non reporting sobs.
    so could you please anyone give me suggestion how i can overcome this problem.
    here i am pasting the complete query also
    SELECT cc.segment3 department, cc.segment4 ACCOUNT,
    cc.segment5 business_unit, 0 period_order,
    SUM (NVL (accounted_dr, 0) - NVL (accounted_cr, 0)) amount,
    TO_CHAR (TRUNC (TO_DATE (:p_run_date, 'DD-MON-RR')),
    'MON-YY'
    ) period_name,
    gsb.set_of_books_id, gsb.currency_code
    FROM gl_code_combinations cc,
    gl_je_headers h,
    gl_je_lines l,
    gl_sets_of_books gsb,
    gl_consolidation gc1,
    gl_consolidation gc2
    WHERE to_number_no_null (cc.segment4) < 700000
    AND cc.code_combination_id = l.code_combination_id
    AND cc.chart_of_accounts_id = :p_coa_id
    AND h.je_header_id = l.je_header_id
    AND h.actual_flag = 'A'
    AND NVL (h.currency_code, 'XXX') != 'STAT'
    AND l.set_of_books_id = gsb.set_of_books_id
    AND gsb.set_of_books_id = gc1.from_set_of_books_id
    AND gc1.to_set_of_books_id = gc2.from_set_of_books_id
    AND gc2.to_set_of_books_id = :p_sob_id
    AND l.status = 'P'
    AND NVL (l.effective_date, :p_run_date) <= LAST_DAY (:p_run_date)
    GROUP BY cc.segment3,
    cc.segment4,
    cc.segment5,
    TO_CHAR (TRUNC (TO_DATE (:p_run_date, 'DD-MON-RR')), 'MON-YY'),
    gsb.set_of_books_id,
    gsb.currency_code
    HAVING SUM (NVL (accounted_dr, 0) - NVL (accounted_cr, 0)) <> 0
    UNION
    SELECT cc.segment3 department, cc.segment4 ACCOUNT,
    cc.segment5 business_unit, 0 period_order,
    SUM (NVL (accounted_dr, 0) - NVL (accounted_cr, 0)) amount,
    TO_CHAR (TRUNC (TO_DATE (:p_run_date, 'DD-MON-RR')),
    'MON-YY'
    ) period_name,
    gsb.set_of_books_id, gsb.currency_code
    FROM gl_code_combinations cc,
    gl_je_headers h,
    gl_je_lines l,
    gl_sets_of_books gsb,
    gl_consolidation gc1,
    gl_consolidation gc2
    WHERE to_number_no_null (cc.segment4) < 700000
    AND cc.code_combination_id = l.code_combination_id
    AND cc.chart_of_accounts_id = :p_coa_id
    AND h.je_header_id = l.je_header_id
    AND h.actual_flag = 'A'
    AND NVL (h.currency_code, 'XXX') != 'STAT'
    AND l.set_of_books_id = gsb.set_of_books_id
    AND gsb.set_of_books_id = gc1.from_set_of_books_id
    AND gc1.to_set_of_books_id = gc2.from_set_of_books_id
    AND gc2.to_set_of_books_id = :p_sob_id
    AND l.status = 'P'
    AND NVL (l.effective_date, :p_run_date) >=
    ADD_MONTHS (TRUNC (:p_run_date, 'MON'), 0)
    AND NVL (l.effective_date, :p_run_date) <=
    (ADD_MONTHS (TRUNC (:p_run_date, 'MON'), 1) - 1
    GROUP BY cc.segment3,
    cc.segment4,
    cc.segment5,
    TO_CHAR (TRUNC (TO_DATE (:p_run_date, 'DD-MON-RR')), 'MON-YY'),
    gsb.set_of_books_id,
    gsb.currency_code
    HAVING SUM (NVL (accounted_dr, 0) - NVL (accounted_cr, 0)) <> 0
    thanks,
    Malla

    Anup,
    Neither ReportQuery or partial attribute queries are cached in TopLink's object cache. This is just for complete objects. It is possible to cache the results of any query in the query itself. This requires you to either hold the query or have TopLink's QueryManager cache the named query for you.
    Then you can configure the query to hold its results for subsequent executions.
    (http://otn.oracle.com/docs/products/ias/doc_library/90200doc_otn/toplink.903/tl_flapi/oracle/toplink/queryframework/ReadQuery.html#setShouldCacheQueryResults(boolean))
    Doug Clarke

  • Report Query returning "No Data Found" with bind variables

    I put a simple query into Report Query:
    Select "bluefish". "name" as "name",
    "bluefish"."primary_flag" as "primary_flag",
    "bluefish"."status" as "status",
    "bluefish"."ID" as "ID" from "bluefish" "bluefish" where "bluefish"."ID" = :P3_XPRINTID
    When I test the query, data is returned; however, when I try to run the query using "Test Report" button, I get an error 01403 No Data Found. If I replace the bind variable with an explicit value, the report works.
    Anyone have any ideas as to what is causing this problem? I am using the Generic Report Layout, with various output types. I AM editting the query and defining the bind variable before I test the report (otherwise, the query wouldn't run).
    Charles

    Sometimes if you create a form/report/whatever using the wizards, it will create an After Submit process called something like Reset Page - basically you want to make sure you don't have any After Submit processes that call a Clear Session state (it may say something like Clear Cache for Page).
    In your branch, there is also a box that says Clear Cache - you want to make sure that does not have page Number 8 in it or it will clear your session state.
    Put the page in Debug mode and read through it - check to make sure your value is getting saved and maybe you can see what is going wrong.

  • Generic report query that will work against common table ..

    Context
    We have a custom audit log scheme that inserts all table changes into a backing table via triggers. For example, an insert into table ORDER would cause a insert into ORDER_AUD.
    Problem
    We want to build a generic report query that will work against any audit table.
    While constructing a report query for a class that uses inheritance, we see TopLink? add an extra where-clause.
    We are required to set the ReferenceClass? for the query, however, the tables we are querying are not mapped to TopLink?. We just want to map the query results to objects of the Reference Class.
    The extra where-clause specifies the table of the Reference Class, but since that table is not in the From clause, the query doesn't work.
    The ReportQuery? in Question
    public DatabaseQuery loadAuditHistory(Class cls, String audTableName ) {
    String emanAuditTableName = "eman_audit";
    ExpressionBuilder expressionBuilder = new ExpressionBuilder();
    Expression exp = expressionBuilder.getTable(audTableName)
    .getField("instance_id")
    .equal(expressionBuilder.getParameter("instanceId"))
    .and(expressionBuilder.getTable(audTableName).getField("audit_id")
    .equal(expressionBuilder.getTable(emanAuditTableName).getField("audit_id")));
    ReportQuery query = new ReportQuery(expressionBuilder);
    query.setReferenceClass(cls);
    query.setSelectionCriteria(exp);
    query.addArgument("instanceId");
    query.addAttribute("Changed By", expressionBuilder.getTable(emanAuditTableName).getField("audit_user"));
    query.addAttribute("Host", expressionBuilder.getTable(emanAuditTableName).getField("audit_host"));
    query.addAttribute("UTC Timestamp", expressionBuilder.getTable(emanAuditTableName).getField("audit_utc_timestamp"));
    query.addAttribute("Action", expressionBuilder.getTable(audTableName).getField("table_action_code"));
    Descriptor orderDescriptor = session.getDescriptor(cls);
    Vector mappings = orderDescriptor.getMappings();
    for (Iterator iter = mappings.iterator(); iter.hasNext();) {
    Object element = (Object) iter.next();
    if (element instanceof DirectToFieldMapping) {
    DirectToFieldMapping mapping = (DirectToFieldMapping)element;
    DatabaseField field = mapping.getField();
    String tableName = field.getTableName();
    String fieldName = field.getName();
    query.addAttribute(fieldName, expressionBuilder.getTable(audTableName).getField(fieldName));
    Expression version = expressionBuilder.getTable(audTableName).getField("version_id");
    query.addOrdering(version.descending());
    query.setName(GET_AUDIT_HISTORY);
    return query;
    Code Generated by the ReportQuery?
    SELECT t0.audit_user, t0.audit_host, t0.audit_utc_timestamp,
    t1.table_action_code, t1.INSTANCE_ID, t1.STATUS,
    t1.REQUESTER, t1.DESCRIPTION, t1.RECIPIENT
    FROM eman_audit t0, example_order_aud t1
    WHERE (((t1.instance_id = 60432)
    AND (t1.audit_id = t0.audit_id))
    AND (EXAMPLE_ORDER.CLASS_NAME = 'eman.infra.toplink.example.project.model.Order'))
    ORDER BY t1.version_id DESC
    Descriptor used to Map Oder.class
    public Descriptor buildOrderItemDescriptor() {
    Descriptor descriptor = new Descriptor();
    descriptor.setJavaClass(eman.infra.toplink.example.project.model.OrderItem.class);
    descriptor.addTableName("ORDERITEM");
    descriptor.addPrimaryKeyFieldName("ORDERITEM.INSTANCE_ID");
    // Inheritance properties.
    descriptor.getInheritancePolicy().setClassIndicatorFieldName("ORDERITEM.CLASS_NAME");
    descriptor.getInheritancePolicy().useClassNameAsIndicator();
    // Descriptor properties.
    descriptor.useSoftCacheWeakIdentityMap();
    descriptor.setIdentityMapSize(100);
    descriptor.useRemoteSoftCacheWeakIdentityMap();
    descriptor.setRemoteIdentityMapSize(100);
    descriptor.setSequenceNumberFieldName("ORDERITEM.INSTANCE_ID");
    descriptor.setSequenceNumberName("CIM_ID");
    VersionLockingPolicy lockingPolicy = new VersionLockingPolicy();
    lockingPolicy.setWriteLockFieldName("ORDERITEM.VERSION_ID");
    descriptor.setOptimisticLockingPolicy(lockingPolicy);
    descriptor.setAlias("OrderItem");
    // Query manager.
    descriptor.getQueryManager().checkCacheForDoesExist();
    //Named Queries
    // Event manager.
    // Mappings.
    DirectToFieldMapping instanceIdMapping = new DirectToFieldMapping();
    instanceIdMapping.setAttributeName("instanceId");
    instanceIdMapping.setFieldName("ORDERITEM.INSTANCE_ID");
    descriptor.addMapping(instanceIdMapping);
    DirectToFieldMapping ItemNumberMapping = new DirectToFieldMapping();
    ItemNumberMapping.setAttributeName("ItemNumber");
    ItemNumberMapping.setFieldName("ORDERITEM.ITEM_NUMBER");
    descriptor.addMapping(ItemNumberMapping);
    DirectToFieldMapping QuantityMapping = new DirectToFieldMapping();
    QuantityMapping.setAttributeName("Quantity");
    QuantityMapping.setFieldName("ORDERITEM.QUANTITY");
    descriptor.addMapping(QuantityMapping);
    OneToOneMapping orderMapping = new OneToOneMapping();
    orderMapping.setAttributeName("order");
    orderMapping.setReferenceClass(eman.infra.toplink.example.project.model.Order.class);
    orderMapping.setRelationshipPartnerAttributeName("orderItems");
    orderMapping.dontUseIndirection();
    orderMapping.addForeignKeyFieldName("ORDERITEM.ORDER_ID", "EXAMPLE_ORDER.INSTANCE_ID");
    descriptor.addMapping(orderMapping);
    return descriptor;

    I'm am very confused as to what you are trying to do, are you trying to query Order objects from the ORDER_AUD historical table instead of the table that the class is mapped to?
    TopLink 10.1.3 (DP3) has built in support for historization, you may wish to investigate this support to allow historical querying of your audit tables.
    In general you cannot use a ReportQuery to do this, a ReportQuery is for querying data from objects based on an object-level criteria. I think that you want to query objects, but just using different SQL than the descriptors are mapped to.
    You could do this through a custom SQL read query,
    i.e.
    ReadAllQuery query = new ReadAllQuery(Order.class);
    query.setSQLString("Select * from ORDER_AUD where INSTANCE_ID = #id");
    query.addArgument("id");
    Vector argumentValues = new Vector(1);
    argumentValues.add(id);
    List objects = (List) session.executeQuery(query, argumentValues);
    As long as the field names in the audit and the original table matched this would work. However if this is a historical table, then I would guess that there might be multiple objects with the same id, so querying these historical objects could confuse the TopLink cache. You could set dontMaintainCache() on the query to avoid this.
    In general you would probably be much better off having two sessions, one with the descriptors mapped to the normal tables, and one with the descriptors mapped to the audit tables. Then you would be able to query both using regular object-level queries.

  • Need to create report query to get latest open and last closed period for given application

    Hi All,
    I need to create a report query to get below result displayed in report output.
    1)   -   Application name
    2)   -    Ledger name
    -o/  -Operating Unit
    3)   -  Last Closed Period
    4)   -  Current Open Period
    5)   -  Date Closed – Last Closed Period
    6)   -  Date Open – Current Open Period
    I tr I tried to create the query below is the same. Please let me know if it looks fine.
    SELECT *
      FROM (SELECT fav.application_name ,
                   hou.name Operating_Unit_Name,
                   gl.name Ledger_name,
                   gl.latest_opened_period_name,
                   gps.period_name Period_Name,
                   DECODE(gps.closing_status, 'O', 'Open', 'C', 'Closed') status,
                   gps.last_update_date Last_status_modified_date
              FROM gl_period_statuses gps,
                   gl_sets_of_books   gsob,
                   fnd_application_vl fav,
                   hr_operating_units hou,
                   gl_ledgers         gl
             WHERE gps.period_name = gps.period_name
               AND gps.closing_status ='C'
               AND fav.application_short_name =
                   NVL('&p_application_short_name', fav.application_short_name)
               AND gps.application_id = fav.application_id
               AND gsob.set_of_books_id = gps.set_of_books_id
               AND hou.set_of_books_id = gps.set_of_books_id
               AND gl.ledger_id = gsob.set_of_books_id
               AND hou.organization_id=NVL('&p_operating_unit',hou.organization_id)
               AND gl.ledger_id=NVL('&p_ledger_id',gl.ledger_id) 
             ORDER BY gps.last_update_date desc )WHERE ROWNUM = 1 
    UNION ALL
    SELECT *
      FROM (SELECT fav.application_name Application_Name,
                   hou.name Operating_Unit_Name,
                   gl.name Ledger_name,
                   gl.latest_opened_period_name,
                   gps.period_name Period_Name,
                   DECODE(gps.closing_status, 'O', 'Open', 'C', 'Closed') status,
                   gps.last_update_date Last_status_modified_date
              FROM gl_period_statuses gps,
                   gl_sets_of_books   gsob,
                   fnd_application_vl fav,
                   hr_operating_units hou,
                   gl_ledgers         gl
             WHERE gps.period_name = gps.period_name
               AND gps.closing_status = 'O'
               AND fav.application_short_name =
                   NVL('&p_application_short_name', fav.application_short_name)
               AND gps.application_id = fav.application_id
               AND gsob.set_of_books_id = gps.set_of_books_id
               AND hou.set_of_books_id = gps.set_of_books_id
               AND gl.ledger_id = gsob.set_of_books_id
               AND hou.organization_id=NVL('&p_operating_unit',hou.organization_id)
               AND gl.ledger_id=NVL('&p_ledger_id',gl.ledger_id) 
             ORDER BY gps.last_update_date desc)
             WHERE ROWNUM = 1

    It is within the table I believe (I'm not a DBA or a developer) since I created a BLOB column and then used the file browse feature to allow users to attach a resume to the table in order to be able to perform a search of the attached documents.
    I'm just having a hard time pointing the link in the search results report to the document in the blob column.
    The information on that page is great if you're trying to create a link to the document on the initial report.
    But I created a query using Oracle Text to run a report that does a boolean search of the attached word documents in the table.
    When it displays the search results, it doesn't create a link to the document and I can't figure out how to do it.
    Here's a link the the instructions I used to create the initial search report with Oracle Text, mind you I only created the index and query, I didn't add in all the link data since they're using documents on websites and I'm using documents in a table.
    http://www.oracle.com/technology/products/database/application_express/pdf/apex_text_application_v1.6.pdf
    If you can help me with this I'd really appreciate it.
    Thanks again.
    Greg
    Edited by: gjones77 on Dec 2, 2008 8:14 AM

  • Report-Query Value

    Hi Experts,
    Currently we are using one BW report in 3.5version(report query against multi provider).
    Current issue:
    Cube Fields:
    PO Number: 123
    Order value 100.
    Confirmation value 50
    Final Delivery Indicator: X (YES-No more confirmation is expected)
    Calculation on the Query:
    Outstanding Confirmed Value= Order Value - Net Confirmed Value
    Here Outstanding Confirmed Value = 100-50=50.So in the reports, Outstanding Confirmed Value shows 50.
    But the PO's Final Delivery Indicator is marked. So No more confirmation is expected
    Question:
    I am not able to create any formula against the filed Final Delivery Indicator. But i want to show in the report that if the PO's Final Delivery Indicator marked, then Outstanding Confirmed Value has to be 0(ZERO).
    Please help me achieve this result. Thanks.
    Advance Thanks.
    RR.

    Hi ,
    This can be achived in the following way.
    1. Create your formula
        "Outstanding Confirmed Value= Order Value - Net Confirmed Value" and hide it using the property.
    2. Create one more forumala which will check the condition. i.e. if the Final Delivery Indicator is marked then it will set the outstanding confirmed value as zero else it will show the value which we are getting by using above mentioned formula.
    put the following condition in the formula.
    [Final Delivery Indicator = = 0 ] * 0 + [Final Delivery Indicator <> 0]*Outstanding Confirmed Value
    This will work as follow.
    For example : Outstanding Confrimed Value is 50 and Final Delivery Indicator is marked.
    = [ 0 == 0 ] * 0 + [ 0 <> 0 ] * 50
    = 1* 0 + 0 * 50              " When the condition is satisfied its result is 1. here 0 == 0 condtion is satisfied so its return value is 1.
    = 0
    Hope this will help.
    - Jaimin

  • Performance issues when creating a Report / Query in Discoverer

    Hi forum,
    Hope you are can help, it involves a performance issues when creating a Report / Query.
    I have a Discoverer Report that currently takes less than 5 seconds to run. After I add a condition to bring back Batch Status that = ‘Posted’ we cancelled the query after reaching 20 minutes as this is way too long. If I remove the condition the query time goes back to less than 5 seconds.
    Please see attached the SQL Inspector Plan:
    Before Condition
    SELECT STATEMENT
    SORT GROUP BY
    VIEW SYS
    SORT GROUP BY
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID GL.GL_CODE_COMBINATIONS
    AND-EQUAL
    INDEX RANGE SCAN GL.GL_CODE_COMBINATIONS_N2
    INDEX RANGE SCAN GL.GL_CODE_COMBINATIONS_N1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUES_N1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUE_SETS
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUE_SETS_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES_TL
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUES_TL_U1
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUE_NORM_HIER_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_LINES
    INDEX RANGE SCAN GL.GL_JE_LINES_N1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_HEADERS
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_DAILY_CONVERSION_TYPES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_SOURCES_TL
    INDEX UNIQUE SCAN GL.GL_JE_SOURCES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    INDEX UNIQUE SCAN GL.GL_BUDGET_VERSIONS_U1
    INDEX UNIQUE SCAN GL.GL_ENCUMBRANCE_TYPES_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_BATCHES
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_PERIODS
    INDEX RANGE SCAN GL.GL_PERIODS_U1
    After Condition
    SELECT STATEMENT
    SORT GROUP BY
    VIEW SYS
    SORT GROUP BY
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS OUTER
    NESTED LOOPS
    TABLE ACCESS FULL GL.GL_JE_BATCHES
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_HEADERS
    INDEX RANGE SCAN GL.GL_JE_HEADERS_N1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    INDEX UNIQUE SCAN GL.GL_ENCUMBRANCE_TYPES_U1
    INDEX UNIQUE SCAN GL.GL_DAILY_CONVERSION_TYPES_U1
    INDEX UNIQUE SCAN GL.GL_BUDGET_VERSIONS_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_SOURCES_TL
    INDEX UNIQUE SCAN GL.GL_JE_SOURCES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN GL.GL_JE_BATCHES_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_JE_LINES
    INDEX RANGE SCAN GL.GL_JE_LINES_U1
    INDEX UNIQUE SCAN GL.GL_SETS_OF_BOOKS_U2
    TABLE ACCESS BY INDEX ROWID GL.GL_CODE_COMBINATIONS
    INDEX UNIQUE SCAN GL.GL_CODE_COMBINATIONS_U1
    TABLE ACCESS BY INDEX ROWID GL.GL_PERIODS
    INDEX RANGE SCAN GL.GL_PERIODS_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUES_N1
    INDEX RANGE SCAN APPLSYS.FND_FLEX_VALUE_NORM_HIER_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUES_TL
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUES_TL_U1
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_FLEX_VALUE_SETS
    INDEX UNIQUE SCAN APPLSYS.FND_FLEX_VALUE_SETS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    INDEX UNIQUE SCAN GL.GL_JE_HEADERS_U1
    Is there anything i can do in Discoverer Desktop / Administration to avoid this problem.
    Many thanks,
    Lance

    Hi Rod,
    I've tried the condition (Batch Status||'' = 'Posted') as you suggested, but the qeury time is still over 20 mins. To test i changed it to (Batch Status||'' = 'Unposted') and the query was returned within seconds again.
    I’ve been doing some more digging and have found the database view that is linked to the Journal Batches folder. See below.
    I think the problem is with the column using DECODE. When querying the column in TOAD the value of ‘P’ is returned. But in discoverer the condition is done on the value ‘Posted’. I’m not too sure how DECODE works, but think this could be the causing some sort of issue with Full Table Scans. How do we get around this?
    Lance
    DECODE( JOURNAL_BATCH1.STATUS,
    '+', 'Unable to validate or create CTA',
    '+*', 'Was unable to validate or create CTA',
    '-','Invalid or inactive rounding differences account in journal entry',
    '-*', 'Modified invalid or inactive rounding differences account in journal entry',
    '<', 'Showing sequence assignment failure',
    '<*', 'Was showing sequence assignment failure',
    '>', 'Showing cutoff rule violation',
    '>*', 'Was showing cutoff rule violation',
    'A', 'Journal batch failed funds reservation',
    'A*', 'Journal batch previously failed funds reservation',
    'AU', 'Showing batch with unopened period',
    'B', 'Showing batch control total violation',
    'B*', 'Was showing batch control total violation',
    'BF', 'Showing batch with frozen or inactive budget',
    'BU', 'Showing batch with unopened budget year',
    'C', 'Showing unopened reporting period',
    'C*', 'Was showing unopened reporting period',
    'D', 'Selected for posting to an unopened period',
    'D*', 'Was selected for posting to an unopened period',
    'E', 'Showing no journal entries for this batch',
    'E*', 'Was showing no journal entries for this batch',
    'EU', 'Showing batch with unopened encumbrance year',
    'F', 'Showing unopened reporting encumbrance year',
    'F*', 'Was showing unopened reporting encumbrance year',
    'G', 'Showing journal entry with invalid or inactive suspense account',
    'G*', 'Was showing journal entry with invalid or inactive suspense account',
    'H', 'Showing encumbrance journal entry with invalid or inactive reserve account',
    'H*', 'Was showing encumbrance journal entry with invalid or inactive reserve account',
    'I', 'In the process of being posted',
    'J', 'Showing journal control total violation',
    'J*', 'Was showing journal control total violation',
    'K', 'Showing unbalanced intercompany journal entry',
    'K*', 'Was showing unbalanced intercompany journal entry',
    'L', 'Showing unbalanced journal entry by account category',
    'L*', 'Was showing unbalanced journal entry by account category',
    'M', 'Showing multiple problems preventing posting of batch',
    'M*', 'Was showing multiple problems preventing posting of batch',
    'N', 'Journal produced error during intercompany balance processing',
    'N*', 'Journal produced error during intercompany balance processing',
    'O', 'Unable to convert amounts into reporting currency',
    'O*', 'Was unable to convert amounts into reporting currency',
    'P', 'Posted',
    'Q', 'Showing untaxed journal entry',
    'Q*', 'Was showing untaxed journal entry',
    'R', 'Showing unbalanced encumbrance entry without reserve account',
    'R*', 'Was showing unbalanced encumbrance entry without reserve account',
    'S', 'Already selected for posting',
    'T', 'Showing invalid period and conversion information for this batch',
    'T*', 'Was showing invalid period and conversion information for this batch',
    'U', 'Unposted',
    'V', 'Journal batch is unapproved',
    'V*', 'Journal batch was unapproved',
    'W', 'Showing an encumbrance journal entry with no encumbrance type',
    'W*', 'Was showing an encumbrance journal entry with no encumbrance type',
    'X', 'Showing an unbalanced journal entry but suspense not allowed',
    'X*', 'Was showing an unbalanced journal entry but suspense not allowed',
    'Z', 'Showing invalid journal entry lines or no journal entry lines',
    'Z*', 'Was showing invalid journal entry lines or no journal entry lines', NULL ),

  • Report query with bind variable

    Trying to create a report query for xsl-fo print. For output format I pick "derive from item" then pick the item name from the list, on the next screen, I paste the query with the bind variable. on the next step test query, I always get "data not found" regardless what value I type in. This is the same query that I ran under sql commands without any issues.
    Does anyone run into the same issue as I have when attempted to create a query with bind var ? There is no problem creating a query without bind varibles. . thanks.
    Munshar

    Hi, please did you get any solution to this issue? I am having similar challenge right now.
    select     EMP.DEPTNO as DEPTNO,
         DEPT.DNAME as DNAME,
         EMP.EMPNO as EMPNO,
         EMP.ENAME as ENAME,
         EMP.JOB as JOB,
         EMP.MGR as MGR,
         EMP.HIREDATE as HIREDATE,
         EMP.SAL as SAL
    from     SCOTT.DEPT DEPT,
         SCOTT.EMP EMP
    where EMP.DEPTNO=DEPT.DEPTNO
    and      DEPT.DNAME =upper(:dname)
    This run perfectly in sql developer, toad, and even inside publisher if I login directly to publisher to create report.
    Generating this same query in shared component query builder and testing it returns no data found. If I remove the last line, it works. but with the last line, it return no data found. It seems no one has been able to provide solution to this issue

  • Performance problem with report query

    Hi,
    I am encountering a performance issue with a page returning a report.
    I have a page that has a region which joins 2 tables. One table has about 220,00 rows, while the other contains roughly 60,000 rows. In the region source of the report region, the query includes join condition with local variables. For example, the page is page 70, and some join conditions are:
    and a.id=:P70_ID
    and a.name like :P70_NAME
    I run the query that returns a large number of rows from sqlplus, and it takes less than 30 sec to complete.
    When I run the page, the report took about 3 minutes to return.
    In this case, :P70_NAME is initialized to '%' on the page.
    I then tried to substitute variable value directly in the query:
    and a.id=1000
    and a.name like '%'
    this time the report returned in about 30 sec.
    I then tried another thing which specified the region as "PL/SQL Function returning sql query", and modified the region as follows:
    l_sql := '.......';
    l_sql := l_sql || 'and a.id=' || v('P70_ID')
    and similar substituting :P70_NAME to v('P70_NAME') and append its value to the l_sql string.
    The report query page also returned in 30 sec.
    Is there any known performance issue with using the bind variable (:PXX_XXX) in the report region?

    If you are able.. flush the shared_pool, run your
    report then query the v$sql_area or v$sql_text tables.
    Or do a google query and look up Cary Milsap's piece on enabling extended trace .. there is your sure fire way of finding the problem sql. I am still learning htmldb but is there a way to alter session enable trace in some pre-query block?

  • Creating a print button to call a Report Query and pass filters

    If i use the REPORT QUERY option in APEX 4 to create an statement that is the same one used in an interactive report, can I create a link or button to the REPORT QUERY and pass all the session and filter information from the interactive report to the report query?
    This way I can have the interactive report screen where the user can do all sorts of modifications and such and then pass those to the REPORT QUERY so I can call that from a custom link or button.
    You may ask "why does he need another print button?"
    Answer: I am using a view that has some embedded HTML tags to format the output really nicely. The HTML download version created by the interactive reports works beautifully. The customer also wants a PDF version (meh) which does not render the HTML tags and actually echos them as part of the text. I found that I can create another view that uses the CHR function to create all the breaks and such I was doing with HTML and these do render properly in PDF. So, I figured just have 2 reports: 1 Interactive and 1 using a REPORT QUERY. I just want to call the REPORT QUERY version but use the Interactive Search form to set all the parameters.
    Or, am I over thinking this and there is an easier method?
    I made a previous post where I showed how I got the APEX printing to work and i hoped that helped someone out - fixing this issue would put the whole thing to rest.
    Thanks

    Is BI Publisher desktop (MS Word add-in) a possibility? This would allow you to use MS Word to create your output template (RTF) that would result in a properly formatted PDF. Of course, you'd have to right an updated version of the query without HTML embedded. Just thinking outside of the box.

  • Bind Variables and Shared Component Report Query

    I have a query in a region report which I have replicated to a shared component report query.
    Both queries reference page items as bind variables in the where clause.
    The report region on screen shows the correct results but the report query shows "no data". This is the case when running "Test Query" and "Download XML data" from the shared component report query definition. If I hardcode the variable names I get rows returned, If I use bind variables - and specify the values for these variables I get no data. THe XML file contains the tags for each bind variable I have specified but has no data between the tags. I have Ticked the box to include application and session state but it appears that the bind variables are not being used.
    When I use my report query in the application (URL tied to a button) I get the same problem, the binds are not being passed to the report query.
    Can someone please clarify if this is a bug or not? And if not, how can I get it to work.
    I am using Apex 4.0.2
    Thanks
    Kathryn

    Hi
    To confirm, yes I selected the bind variables. I used these in the report layout, but the xml file has them as empty i.e.
    <P0_START_DATE><P0_START_DATE/> with nothing in between.
    IN the Test Query section, if I put real values in the boxes for the bind variables, I get no data found. If I hardcode the values into the query, I get the data.
    I've repeated the create report query many times and have created a report layout in RTF. I can use the layout with my region - in the print attributes and the layout works with the query but I need to create a PDF using 2 queries - ROWSET1 and ROWSET2. I can generate the XML but the values in the rows are all empty. When I use the layout with a report query instead of the region, I get no data even though I have used the same sql and have selected the bind variables. I was using variables from page items on page zero but have also tried using page items on the current page, the result is the same.
    I need to use a report query and a report layout as I need data from 2 queries in the PDF.
    I looked at your demo - what happens if you add a second sql query to the report query - is there any chance I can look at the back end (developer access?)
    Thanks for your input
    Kathryn

  • Ora-06502 pl/sql numeric or value error in Report Query in oracle apex

    Hello all,
    I need your help...
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    I am using bi publisher to generate PDF reports in oracle apex.
    We were using APEX 4.0 and migrated to 4.2 just a week ago.
    Now we have apex 4.2.
    When I try to Create report query,
    Shared Components >> Report Queries then create.
    and test a report in a create wizard I am getting a error "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
    I have also applied a patch "16760897".
    This issue is because of number of columns in a query is more then 26.
    If I run a report with 26 or less number of columns then the is working fine, otherwise getting this error.
    My before migration report queries working perfectly even now, but not new queries.
    This issue is also in apex.oracle.com.
    You can see
    Not working  - http://apex.oracle.com/pls/apex/f?p=619:4
    Working - http://apex.oracle.com/pls/apex/f?p=619:2:
    Please give a solution.
    Thanks you.

    check the DB version compatibility with apex 4 or your DB version to apex 4.0 support for upgrade!
    Oracle Application Express Installation Requirements for 4.0

  • Report region with column link that opens a pdf doc based on report query

    Hello
    I'm building a report table that displays info about a customer - simple select - and, for each record, has associated column links based on report queries that receive ID as parameter. When clicked, it opens the report in pdf extension. My problem here is how to pass the ID as a parameter to that report query considering i'm using a report table and that there are no items in page 71...
    This is the report query i'm using:
    select initcap(a.customer) customer
    , initcap(a.address) address
    , initcap(a.rep) rep
    , (select initcap(b.city)
    from portal_records b
    where b.contrib=a.contrib
    and b.year=to_char(sysdate,'yyyy')) city
    , (to_char(a.datereg,'dd')||' de '||to_char(a.datereg,'Month')||' de '||to_char(a.datereg,'yyyy')) datereg
    from portal_authorizations_cve a
    where a.id=:P71_ID ???????????????
    I thank in advance all your replies!!

    Hello
    First of all, let me compliment your for your demo application... It's awesome!
    I've looked into your sample (page 15) and, as far as i see, it opens a document saved in a table's column. I don't want the file to be saved there but generated when the user clicks on that particular link... So i still have the problem of how to pass the right ID as a parameter considering there is no page item on that page...
    My javascript knowledge is little so i ask you: when clicking the link, is there any way of opening a window with the url f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=Authorization_CVE and the ID as a parameter?
    I thank in advance!

  • Passing report value to PDF report query

    I apologize if this has already been asked and answered.
    Here's the scenario --
    I have a monthly sales page which displays the company sales for each day of the specified month. I also have a working report query and RTF layout which accepts the invoice date as a parameter which was created with the BI Publisher Word plug-in.
    What I would like to do is add a link or button to each row of the report that would call the PDF report, but passes the #invoice_dt# column in as the parameter. Invoice_DT isn't a session state variable, so is it possible to pass this to the report query?
    Thanks,
    Leigh

    Well, in my search for an answer to a different question, I did run across the answer to this in another thread.
    Re: Passing Parameters to a report query

  • Forming a report query dynamically with the value of an item

    Hi Gurus,
    We wanted to create a report based on the value of an item in the page.
    For example
    There is a text box named p1_table depending on the value of this item the query of the report should change
    1) when p1_table = emp then report query should be select * from emp
    2) when p1_table = dept then report query should be select * from dept
    I tried doing this using
    select * from :p1_table and select * from v('p1_table') , it is not working.
    Kindly help me in achieving the requirement.
    Thanks & Regards,
    Vikas Krishna

    Hi Vikas,
    You have to do this as a report based on a function that returns the query as a string. You build up the string dynamically in the function.
    Regards
    Andre

Maybe you are looking for