Report Query..help

Hi,
I have supplier, qutation and invoice table.
Supplier:
supp_id = supp_name
1 = ABC
2 = XYZ
Qutation:
quta_id = quta_date = supp_id
1 = 12-Dec-2008 = 1
3 = 15-Dec-2008 = 1
5 = 18-Dec-2008 = 1
Invoice:
inv_id = inv_date = supp_id
150 = 01-Dec-2008 = 1
250 = 11-Dec-2008 = 1
100 = 15-Nov-2008 = 2
Qutation and Invoice are non dependent.
I have a report which needs to display following information:
Supplier with total qutation and invoices
Supplier Name = Qutation ID = Qutation Date = Invoice Id = Invoice Date
ABC = 1 = 12-Dec-2008 = 150 = 01-Dec-2008
ABC = 3 = 15-Dec-2008 = 250 = 11-Dec-2008
ABC = 5 = 18-Dec-2008 = * = *
XYZ = * = * = 100 = 15-Nov-2008
You can see there is no record for Invoice in 3rd row and qutation data for 4th row thats why it is showing '*'.
Could you please tell me how to manage such output using Single query
Thanks in advance,
RSD
Edited by: RSD on Dec 30, 2008 6:03 PM

Check this out. You need FULL JOIN
SQL> with supplier
  2  as
  3  (
  4     select 1 supp_id, 'ABC' supp_name from dual
  5     union all
  6     select 2, 'XYZ' from dual
  7  )
  8  , Qutation
  9  as
10  (
11     select 1 quta_id,  to_date('12-Dec-2008','dd-mon-yyyy') quta_date, 1 supp_id from dual
12     union all
13     select 3, to_date('15-Dec-2008','dd-mon-yyyy'), 1 from dual
14     union all
15     select 5, to_date('18-Dec-2008','dd-mon-yyyy'), 1 from dual
16  )
17  , Invoice
18  as
19  (
20     select 150 inv_id, to_date('01-Dec-2008','dd-mon-yyyy') inv_date, 1 supp_id from dual
21     union all
22     select 250, to_date('11-Dec-2008','dd-mon-yyyy'), 1 from dual
23     union all
24     select 100, to_date('15-Nov-2008','dd-mon-yyyy'), 2 from dual
25  )
26  --
27  -- sample date ends here
28  --
29  select supp_name, t.*
30    from (select decode(q.supp_id, null, i.supp_id, q.supp_id) supp_id, q.quta_id, q.quta_date, i.inv_id, i.inv_date
31       from (select row_number() over(partition by supp_id order by quta_id) rno, q.*
32               from qutation q) q
33       full join
34            (select row_number() over(partition by supp_id order by inv_id) rno, i.*
35               from invoice i) i
36         on q.supp_id = i.supp_id
37        and q.rno = i.rno) t
38    join supplier s
39      on t.supp_id = s.supp_id
40  /
SUP    SUPP_ID    QUTA_ID QUTA_DATE     INV_ID INV_DATE
ABC          1          1 12-DEC-08        150 01-DEC-08
ABC          1          3 15-DEC-08        250 11-DEC-08
ABC          1          5 18-DEC-08
XYZ          2                             100 15-NOV-08

Similar Messages

  • Reporting query help

    Hi
    Could someone guide me how to do this?
    Table Data
    NID  COMPANY PID
    ALM   A4U     15
    ALM   B4U     18
    ALM   C4U     22
    ALM   D4U      9
    BLM   C4U     10
    BLM   B4U      5
    Desired Output
    NID    A4U   B4U C4U D4U  Diff (Max-Min)
    ALM   15       18    22   9     13
    BLM              5     10            5Thanks
    Edited by: jdi on Aug 17, 2010 1:51 PM
    Edited by: jdi on Aug 17, 2010 1:53 PM

    Hm... so you want to create a report with more than hundred columns. Why? There a few problems with such an approach.
    1) The human eye is used to process/scan data from top to bottom. It is a little harder to do the same over a wide range from left to right. That's why most books have more height then width. On the other hand a computerscreen has a different format.
    2) Such tasks are usually done by the reporting framework. This can be a tool like Oracle reports but most other tools have possibilities to write such matrix style reports. What tool do you use? SQL*PLUS?
    3) The task of the database is to deliver data. It usually doesn't care how to pretty print the data. If you need to pretty-print it then you need to make some additional effort. This could include having to write many decode statements.

  • Need help troubleshooting Report Query/BI Publisher

    Hi All --
    I need some help with an odd issue I'm having with a report query and BI Publisher. The users run this report by inputting a date range, usually by week. Oddly enough, if we input a date range of 06/01/2008 through 06/07/2008, the report runs and BI Publisher renders the document correctly, but if we input a date range of 06/08/2008 through 06/14/2008, the report shows correctly on the screen, but BI Publisher returns an empty document. I thought perhaps it was an issue with the data, but inputting the date range of 06/01/2008 through 06/14/2008 works correctly and the document is rendered with all the data as shown in the report.
    I'm really at a loss and don't know how to proceed in troubleshooting the issue. Does anyone know of any log files or anything else to look at to try and figure out why the report isn't being rendered correctly for that one week?
    Thanks!
    Leigh Johnson

    Thanks Marc --
    The OC4J logs don't show any errors at the time I tried running the report. I did change the output format to XML and saved it for the date range that doesn't work as well as a date range that does work. As foar as I can tell, the only differences is the data within the tags, but I'm no XML expert so I may have missed something. I opened my report template and loaded the xml data first from the date range that produces a rendered report properly and used preview...as expected it worked. When I did the same thing for the "bad" date range, I get the following set of errors, should I move my issue to the BI Publisher forum do you think?
    ConfFile: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\config\xdoconfig.xml
    Font Dir: C:\Program Files\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\fonts
    Run XDO Start
    Template: D:\BiPublisher\on_time_delivery.rtf
    RTFProcessor setLocale: en-us
    FOProcessor setData: D:\BiPublisher\ontimedelivery.xml
    FOProcessor setLocale: en-us
    Output type: MHTML
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at oracle.apps.xdo.common.xml.XSLT10gR1.invokeProcessXSL(XSLT10gR1.java:721)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:504)
         at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:253)
         at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:181)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:1151)
         at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:275)
         at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1809)
         at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1027)
         at RTF2PDF.runRTFto(RTF2PDF.java:708)
         at RTF2PDF.runXDO(RTF2PDF.java:548)
         at RTF2PDF.main(RTF2PDF.java:305)
    Caused by: oracle.xdo.parser.v2.XPathException: An internal error condition occurred.
         at oracle.xdo.parser.v2.XSLStylesheet.flushErrors(XSLStylesheet.java:1534)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:521)
         at oracle.xdo.parser.v2.XSLStylesheet.execute(XSLStylesheet.java:489)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:271)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:155)
         at oracle.xdo.parser.v2.XSLProcessor.processXSL(XSLProcessor.java:192)
         ... 15 more

  • Report SQL query Help

    Hi,
    I am trying to call a procedure from a SQL report query. Please let me know if this is correct.
    SELECT gb.period_name,
    cc.segment1 uec,cc.segment2 dept, cc.segment3 other,
    cc.segment4 acct,cc.segment5 subacct, cc.segment6 activity,
    cc.segment7 cec, cc.segment8 subelement,cc.segment9 geo,
    cc.segment10 usind,cc.segment11 affiliate,cc.segment12 mpc,
    DECODE ( NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0),
    0, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NULL, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0)
    ) AS Begining_balance_functional,
    DECODE ( NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0),
    0, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NULL, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0)
    ) AS period_to_date_functional,
    (DECODE ( NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0),
    0, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NULL, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0)
    + (DECODE ( NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0),
    0, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NULL, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0)
    ) AS ending_balance_functional,
    NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0) AS begining_balance_entered,
    NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0) AS period_to_date_entered,
    ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    + (NVL (gb.period_net_dr, 0) - NVL (gb.period_net_cr, 0)
    ) AS ending_balance_entered,
    gb.currency_code,gb.period_year, gb.period_num,
    apps.afl_gl_acct.get_value_description('ALCOA UEC',cc.segment1) UEC_Description, apps.afl_gl_acct.get_value_description('ALCOA Cost Center',cc.segment2) Cost_center_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Other',cc.segment3) Other_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Account',cc.segment4) Account_Description,
    apps.afl_gl_acct.get_value_description('ALCOA SubAccount',cc.segment5) SubAccount_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Activity',cc.segment6) Activity_Description,
    apps.afl_gl_acct.get_value_description('ALCOA CEC',cc.segment7) CEC_Description,
    apps.afl_gl_acct.get_value_description('ALCOA SubElement',cc.segment8) SubElement_Description,
    apps.afl_gl_acct.get_value_description('ALCOA GEO',cc.segment9) GEO_Description,
    apps.afl_gl_acct.get_value_description('ALCOA US Ind',cc.segment10) US_Ind_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Affiliate',cc.segment11) Affil_Description,
    afl_gl_acct.get_value_description('ALCOA MPC',cc.segment12) MPC_Description
    FROM GL.GL_BALANCES GB, GL.GL_CODE_COMBINATIONS CC,
    GL.GL_Budget_Versions GBV, GL.GL_SETS_OF_BOOKS GSB
    WHERE GB.CODE_COMBINATION_ID = CC.CODE_COMBINATION_ID
    -- And CC.SEGMENT1 = (se
    And GB.BUDGET_VERSION_ID = GBV.BUDGET_VERSION_ID (+)
    And GSB.SET_OF_BOOKS_ID = GB.SET_OF_BOOKS_ID
    and decode(gb.TRANSLATED_FLAG,'Y','Translated','Entered') =:p_currency_type
    AND cc.segment1 =:p_uec
    AND GSB.NAME = :p_sob_name
    AND gb.PERIOD_NAME= :p_period
    AND cc.segment2= nvl(:p_dept,cc.segment2)
    AND cc.segment3=nvl(:p_other,cc.segment3)
    AND cc.segment4= nvl(:p_acct,cc.segment4)
    AND cc.segment5= nvl(:p_subacct,cc.segment5)
    AND cc.segment6 = nvl(:p_activity,cc.segment6)
    AND cc.segment7 = nvl(:p_cec,cc.segment7)
    and cc.segment8= nvl(:p_subelement,cc.segment8)
    and cc.segment9= nvl(:p_geo,cc.segment9)
    and cc.segment10=nvl(:p_usind,cc.segment10)
    and cc.segment11=nvl(:p_affil,cc.segment11)
    and cc.segment12=nvl(:p_mpc,cc.segment12)
    AND gb.ACTUAL_FLAG = 'A'
    AND gb.CURRENCY_CODE = :p_currency;
    I am not completely sure of the syntax.
    Regards,
    JA

    Please let me know if this is correct.Does it compile? Does it run? Does it return the correct result.
    Please bear in mind we do not have access to your data models so we cannot run it. Nor do we know your business requirements so we cannot assess whether it implements them correctly. And it is way too big a hunk o' code for us to go through it manually.
    As a rule of thumb it is better to build a small query and get that working correctly before adding tables to it rather than building an incomprehensibly large monolith.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • 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 ),

  • 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.

  • 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

  • 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

  • Report query not returning the field value from external table

    hi
    I have an issue regarding reports. I have a query having 4 fields from external table and remaining from db tables. the report query returns all the fields from the db tables and only 2 fields from external table. but the same query if I tried in plsql developer it returns all the fields values.
    Can anyone please help me in this issue.
    Thanks and Regards
    kk

    Duplicate post?
    value not displaying in report whereas it returns in plsql developer
    value not displaying in report whereas it returns in plsql developer
    Please log a SR if you do not get any reply to your thread instead of creating new one.
    Thanks,
    Hussein

  • Setting a bind variable in a Shared Component Report Query

    I have defined a Shared Component Report Query in APEX using a bind variable similar to below
    Select name, id , ....
    from asset
    where id = :id
    I have also created a Report Region that displays a table where one of the columns contains a value I would like to be a link column that can launch the Report Query and pass its value to the bind parameter :id in the report query. This in turn would generate a pdf report for the details associated with that column. I am having problems setting the :id bind parameter. How do I do this?
    Can anyone help?
    Thanks

    The bind values are set from session state. So if try something like this:
    Select name, id , ....
    from asset
    where id = :P1_ID
    With P1_ID being a page item, for which you set the session state / value before generating the PDF file. So assuming you already have a page with a report and a page item, and that page item is already used in your report, then you could just create a button to download the PDF, make sure the button is a submit button, and create a branch pointing to the report query URL (or in 3.1 use the create button wizard, to do this declaratively.)
    Regards,
    Marc

  • What is the best practice for running a long report/query against an active database?

    We are using SQL Server 2012 EE but currently do not have the option to run queries on a R/O mirror though that is my long term goal. I am concerned I may still run into the below issue in that scenario as well since the mirror would also be updating data I
    am querying.
    I have a view that joins across several tables from two databases and is used by an invoicing program on existing data. Three of these tables are also actively updated by ongoing transactions. Running a report that used this view did not use to be a problem
    but now our database is getting larger and we have run into some timeout problems for the live transactions coming in.
    First the report query was timing out so I set command timeout to 0 and reran the query which pegged all 4 CPUs 100% for 90 minutes and so I finally killed it. Strangely there were no problems with active transactions during that time so I'm wondering if the
    query was really running doing anything useful or somehow spinning and waiting. I reviewed the view and found a field I was joining on that was not indexed so created an index on that field, reran the report, which then finished in three minutes and all the
    CPUs were busy but not at all pegged out. Same data queried both times. I figured problem solved. Of course later, my boss ran a similar invoice report, with the same amount of data, and our live transactions started timing out 100% while his query was running.
    I did not get a chance to see the CPU usage during that time.
    I looked at the execution plan of the underlying view and added the suggested index but that did not help. When I run the just the view at SQL Server it does not seem to cause any problems and finished in a couple seconds. Perhaps something else going on in
    the reporting tool using the view.
    My main question is - Given I have to use the live and active database, what is the proper way to run a long R/O query/report so that active transactions can still continue to update
    tables that I am querying? sp_who2 did show transactions being blocked so I guess a long query accessing the tables blocks live transactions accessing those same tables, but certainly I'm not the only one doing this. I
    am considering adding "with (nolock)" but am hoping there is a better standard practice as that clause can return dirty data and I understand why. Thx, Dave
    Thanks, Dave
    Dave

    Hello
    You can change the DB isolation level to Read uncommitted
    http://technet.microsoft.com/en-us/library/ms378149(v=sql.110).aspx
    or use WITH (NOLOCK)
    I do use NOLOCK option for the dirty reads to avoid locks on the tables
    Javier Villegas |
    @javier_vill | http://sql-javier-villegas.blogspot.com/
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you

  • How do I reference columns in a report query from another report query?

    In Apex 3.1 it is possible to generate a report on more than one query. I have read that these queries can be correlated, but I cannot find how in the documentation.
    I go the Shared Components and create a new Report Query:
    select * from dept
    Then I click Add Query and I add:
    select * from emp
    How do I correlate these two queries (I want to join emp.deptno to dept.deptno) and have a nice hierarchicle XML-file.
    Is it possible in Apex 3.1?
    Dik Dral

    Dik,
    This type of query can't be build. The two queries are independent, you can't reference values in the first query from the second query. However you can reference page and application items - which won't help you all that much with this scenario though. You could also try combining the two queries into one, and then take care of the proper presentation in your template.
    Regards,
    Marc

  • How to change report query dynamically in Oracle APEX?

    Hi,
    I want to dynamically change the where condition in APEX report query. Can anyone help me solve my this problem?
    (Just want to change the query which we change in Oracle Reports using lexical parameter to change &Where, &Order by etc. dynamically!!)
    Thanks, Praful

    Hi
    I've been using flexible queries in APEX for a few years now, and your question just added a whole new dimension to the flexible and powerful nature or writing reports in APEX.
    While APEX Interactive reporting has almost completely removed the need the equivalent of Lexicals in Oracle Reports, I thought it might be fun to try and use lexicals in an APEX report.
    Before we start I should summarise the powerful capability of APEX reporting to have oprtional parameters (lots and lots of them if this is needed).
    For each parameter, you simply add a page item which will hold the value of the parameter.
    The item/parameter can be populated by typing in the value, defining an LOV, using a date-picker etc.
    To make the parameter optional simply use an OR in the where clause.
    So for a apge item P200_PARAM1.....include
    WHERE (:P200_PARAM1 IS NULL
    OR COLUMN1 = :P200_PARAM1)
    This way you can either leave the page item null or type in / select a value from a LOV.
    There is a small quirk in APEX LOV's which sometimes returns a value of '%' or '%null%' - depending on the version - when no value is selected.
    See Patrick Wolf's solution for this at Re: Null value handling in LOVs
    I include this Application Process in all my APEX applications ;)
    Now let's look at using the equivalent of Oracle Reports Lexicals......
    First-off - this is based on the APEX SQL report - NOT Interactive Report.
    It relies on the fact that you can let the query be parsed only at runtime.
    1. Define an SQL report entering the 'core' of your query.
    With a query like SELECT ENAME, JOB FROM EMP
    Select 'Generic Columns' option in the 'Column Headings' section
    Finish the report creation
    2. Define a page item - say P200_LEXICAL - type text on the page
    3. Edit the report and update the SQL query to include your lexical page item
    SELECT ENAME, JOB FROM EMP &P200_LEXICAL. (REMEMBER THE '.' AT THE END)
    Ensure that the option "Use Generic Column Names (parse query at runtime only)" is selected at the bottom of the query
    4. Add a button to the page -using 'Create a button displayed among this region's items' the will submit the page.
    5. Run the page - you will see all the employee names and job desdriptions
    6. Enter a where clause into the 'Lexical' textbox - say "WHERE ENAME LIKE 'K%'" and click the 'Go' button
    Voila! your where clause is magically applied.
    Try any variant you like adding an ORDER BY clause etc...... this is FUN!
    7. Clear the value of the LEXICAL and click go.
    Edit the report and move the &P200_LEXICAL. into the selected columns (or add another one)
    SELECT ENAME, JOB &P200_LEXICAL. FROM EMP
    8. Run the page
    Enter ",SAL" in the textbox and "Go"
    We can add as many columns as we like (subject to the "Maximum number of generic report columns:" set below the SQL query in the report edit section)
    Now because we have all the flexibility in APEX of setting page items using SQL or PLSQL you can set the value of the lexical programatically, or just pre-set a few values in an LOV - the options are limitless.
    While I've never had the need to use lexicals - you can see that APEX provides the most Flexible Lexicals in town.
    Eat your heart out "Oracle Reports"!!!
    Have fun
    Mike

  • Conditional SQL in Report Query

    How can I code a conditional SQL in the Report query builder
    to include a WHERE clause parameter or not, depending on the value
    of a report parameter? Basically, what I want to do is:
    select field from table where x=1
    <cfif param.a eq 1>and a=1</cfif>
    Report builder does not like this, but I can't find any help
    on how to do this.

    I don't think CFML tags may be used like that in the SQL of
    report query. But then, I'm not very much into reports. If you're
    just out to get the result, then try
    select field from table
    where
    (x=1 and #param.a# <> 1) or (x=1 and #param.a#=1 and
    a=1)

Maybe you are looking for