Result := dbms_xmlsquery.getXml(queryCtx);  1 row only is returned.

I get only one record returned. The following code is taken from my block
-- set up the query context...!
queryCtx := DBMS_XMLQuery.newContext(l_stmt_sel || 'pris.' || l_table || '@rel ' );
-- DBMS_XMLQuery.setRowTag(queryCtx,'???'); -- sets the row tag name
DBMS_XMLQuery.setRowSetTag(queryCtx,l_table ); -- sets rowset tag name
--DBMS_XMLQuery.setMaxRows(queryCtx,2);
-- get the result..!
result := DBMS_XMLQuery.getXML(queryCtx);
-- Now you can use the result to put it in tables/send as messages..
printClobOut(result);
DBMS_XMLQuery.closeContext(queryCtx); -- you must close the query handle.
the table has two rows in it.
Result set when setmaxrows = 1
DBMS_XMLQuery.setMaxRows(queryCtx,1);
| <?xml version = '1.0'?>
| <X_HOUSING_V>
| <ROW num="1">
| <HOU_BOOKNO>1564922</HOU_BOOKNO>
| <HOU_ENTNO>2</HOU_ENTNO>
| <HOU_ENT_DATE>11/8/2007 17:17:0</HOU_ENT_DATE>
| <HOU_ENT_TIME>1717</HOU_ENT_TIME>
| <HOU_ENT_OPER>S01072</HOU_ENT_OPER>
| <HOU_FAC>C</HOU_FAC>
| <HOU_TIER>01A</HOU_TIER>
| <HOU_BED>020</HOU_BED>
| <HOU_AUTH_OFF>S01072</HOU_AUTH_OFF>
| <HOU_BEGIN_DATE>11/8/2007 17:17:0</HOU_BEGIN_DATE>
| <HOU_BEGIN_TIME>1717</HOU_BEGIN_TIME>
| <HOU_REASON>BI</HOU_REASON>
| <HOU_TIER_COMMENT>1564922 DNGRM TX 12-18</HOU_TIER_COMMENT>
| </ROW>
| </X_HOUSING_V>
when max rows is removed i get the following error.
--DBMS_XMLQuery.setMaxRows(queryCtx,1);
BEGIN
| <?xml version = '1.0'?>
| <ERROR>oracle.xml.sql.OracleXMLSQLException:
java.lang.ArrayIndexOutOfBoundsException</ERROR>
PL/SQL procedure successfully completed.
when max rows is set to 2 i get the following error.
DBMS_XMLQuery.setMaxRows(queryCtx,2);
| <?xml version = '1.0'?>
| <ERROR>oracle.xml.sql.OracleXMLSQLException:
java.lang.ArrayIndexOutOfBoundsException</ERROR>
PL/SQL procedure successfully completed.

thank you for your reply sir !
i am running the query in Keeptool 9. and am getting this output in the DBMS Output window.
and secondly even if the output window is unable to show it, at least the table should save the contents right. But the contents of table are also not well formed xml as it contains invalid characters.
all at loss :-s

Similar Messages

  • When using private browsing to view image results in Safari 5.1.3, only the first two rows of results are visible, the following four or so rows display greyed out place holders, and the safe search button is inoperable. Suggestions?

    When using private browsing to view image results in Safari 5.1.3, only the first two rows of results are visible, the following four or so rows display greyed out place holders, the remainder of the results page is blank, and the safe search button is inoperable. When I turn off private browsing and refresh the page, everything works again.
    Anyone else having this problem?

    I have got the same behaviour after the last Safari Update to 5.1.3. It seems that Safari now handles some scripts in a new way. If you debug the Google Website, you will see, that there is some Javascript Error, that seems to prevent to write into local cache. After some searching I wasn't able to finde a solution for this problem, other then disabling Javascript while private browsing to prevent the script loading. You then are able to use Google with the old layout. The option to disable JavaScript can be found in the Menu "Developer", wich has to be enabled in Safari in the options first.
    In my opinion this is a bug that is now occuring, because Apple changed something in private browsing and that has to be fixed by Google now, to run again. Or we will have to wait for 5.1.4, as you can read online Apple will change and bugfix the javascript engine in that version, perhaps this fixes the problem as well. I hope so!
    If anyone is in the developer program perhaps you could test this with the beta of 5.1.4 and tell us if it works.

  • Query results window limited to 100 rows then 150 then 200

    Great product - I love this tool and don't mind helping to find the bugs in the prereleases like this.
    When I
    SELECT * FROM MY_TABLE
    in a sql worksheet, the results window initially only displays the first 100 rows.
    I can try to scroll down, but it stops at 100 rows.
    If click on Script Output window, the fetch count goes up to 150 and if I click back into
    Results window, I can then scroll to row 150. Click back over to Script Output and come back, now I'm up to 200. As long I scroll to the bottom of the Results window and click back and forth, I can increase the size of the results window by 50 rows each time. If I want the result window to show 2000 rows this will get real tedious real quick...
    Maybe a bug in dynamically resizing the result set?

    Hi gary,
    You may have already seen one or more threads like the following on the issue of increased memory overhead for the Excel formats:
    Re: Sql Developer 3.1 - Exporting a result set in xls generates and empty file
    Basically SQL Developer uses a third-party API to read and write these Excel formats. There are distinct readers and formatters for each of the xls and xlsx forms.
    There is a newer version of the API that supports streaming of xlsx Workbooks. Basically it achieves a much lower footprint by keeping in memory only rows that are within a sliding window, while the older, non-streaming version gives access to all rows in the document. The programmer may define the size of this window. I believe the newer API version was either not available or not stable during our 3.1 development cycle. Possibly a future SQL Developer version might use it.
    Regards,
    Gary
    SQL Developer Team

  • Need a report column to hold data for one row only

    Hey Guys,
    I have a report which has a column that links to another page in my APEX application.
    There is a requirement where only one of the rows in this report needs to have a link so I need the column to show the page link for one row and one row only.
    The report will have about 5 rows at a time so is there a way to just make this link appear for the one row(it will be the top row) in the column attirbute in APEX? or can this be done in the SQL for the report?
    Any help is much appreciated
    Thanks
    -Mark

    Hi
    The only way (I believe) to do this is within the SQL. Then you just wrap the column in a CASE statement and if it meets your criteria then build up the link and if not then display normally.
    Something like this...
    SELECT ename,
           CASE WHEN empno = 7839
           THEN '<a href="f?p='||:APP_ID||':4:'||:APP_SESSION||'::NO::P4_TARGET_ITEM:'||empno||'" >'||empno||'</a>'
           ELSE TO_CHAR(empno)
           END empno
    FROM empCheers
    Ben

  • Change background and font for first row only?

    Hi, 
    Have a tablix in SSRS (2008R2) and would like to change the background colour and font for the first row only, is this possible and if so how would I achieve this? 
    I have followed and example on setting alternate row background colour in the properties but can't see how to do this for just the first row. 
    =IIF(RowNumber(Nothing) MOD 2,”LightGrey”, “LightBlue”)
    Thanks 

    Hello,
    The Expression uses a Modulo function to calculate every second row. In your case just compare with equal 1 for the first row:
    =IIF(RowNumber(Nothing) = 1, ”LightGrey”, “LightBlue”)
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Current row only

    Hello all ,
    I have a form in 10 g oracle . It has two data blocks .
    Now the problem is i am creating a letter ( report oracle) and for this i need to use both the blocks .
    i need add1,add2,company , contact froom block 1 . which is not a prob BUT
    from block 2 i need to get only data from that row which is highlighted when i select it .
    in block 2 for a particular company there might be 4 rows with data in fields , but i want a particular row only to be in the letter .
    i dont have ids for different rows but i have a id for block 1 ,and to fetch data from block 2 i am ref that same id .
    NOW i created a letter report and it worked but i am getting all the rows and not ONLY the row which is highighted . i just want data from the highlighted row.
    PLEASE HELP AND SORRY FOR MY ENGLISH :)

    Ok,
    blocks = companies , letters
    companies => company ,add1,add2,contact etc
    letters => amount,outcome,date_outcome etc
    outcome = awarded,rejected,pending .
    NOW :
    I want to have a letter with company , add1,add2,comtact from companies .
    and amount,outcome from letters.
    one comapny can have more than one data in letters block .
    example -->
    IN COMPANIES :
    company = cool
    id = 11
    add1 = london
    add2 = uk
    IN LETTERS :
    c_id = 11
    outcome = awarded
    amount = 500
    date_outcome 26/11/07
    outcome = awarded
    amount 100
    date_outcome = 20/04/07
    outcome = pending
    amount = 0
    date_outcome = ''
    outcome = rejected
    amount = 0
    date_outcome = 11/12/07
    now this particular company has 4 records in letters block. i have a button in the form which gives me a letter . but i info in the letters along with the company details should have the details on the particular row ( i.e outcome , amount ,date_outcome) but at the moment it gives me records for all 4 .
    i want to get the data out in letter for the row which is highlighted or rather which is selected by clicking / putting my mouse cursor on .
    now does it make sense ?
    plz help i am running out of time !
    cheers.

  • Oracle bi delivers - Show relevant rows only (under Recipients) not working

    Hi,
    My requirement is to send a report to multipel users and each user should get only relevant information mapped to his email id. If I uncheck option "Show relevant rows only", iBot is working and delivering report but our requirement is to send data related to user. For the I checked "Show relevant rows only" but after that iBot is not sending email. I checked the log at "product/OBIEE/OBIHome/server/Log/iBots", but there is no error.
    If someone has faced this issue and has solution please let me know.
    Thanks a lot.
    Mukul

    You need to set "Data Visilibity" as "Personalized" in the General tab. That means that the iBot will run for each user as each user therefore you need to make sure that each user can read the iBot and the requests that it uses.

  • Does using "fetch first N rows only" make /*+ FIRST_ROWS([N]) */ hint redundant?

    I know the FIRST_ROWS hint tells the optimizer to minimize time to first row.  I know the new 12c functionality for "FETCH [FIRST|NEXT] [N] ROWS [ONLY|WITH TIES]"fetch first/next N rows only/with ties" will implement the query using ROW_NUMBER().  Should I leave hint in case it improves performance, or does the FETCH FIRST clause make this hint redundant?

    maybe the answer to this question is more complicated then I assumed at first: as Randolf Geist wrote in his presentation Everything You Wanted To Know About FIRST_ROWS_n But Were Afraid To Ask a rownum predicate implicitly defines a first rows n optimization. So I guessed that the fetch first clause would trigger a similar optimization. But a rownum predicate and a fetch first clause are not transformed into the same operation:
    create table t
    as
    select rownum id
      from dual
    connect by level <= 1000000;
    select id
      from t
    where rownum <= 5;
       ID
        1
        2
        3
        4
        5
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     5 |    25 |     2   (0)| 00:00:01 |
    |*  1 |  COUNT STOPKEY     |      |       |       |            |          |
    |   2 |   TABLE ACCESS FULL| T    |     5 |    25 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter(ROWNUM<=5)
    select id
      from t
    fetch first 5 rows only;
       ID
        1
        2
        3
        4
        5
    | Id  | Operation              | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |      |  1000K|    24M|   427   (1)| 00:00:01 |
    |*  1 |  VIEW                  |      |  1000K|    24M|   427   (1)| 00:00:01 |
    |*  2 |   WINDOW NOSORT STOPKEY|      |  1000K|  4882K|   427   (1)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL   | T    |  1000K|  4882K|   427   (1)| 00:00:01 |
    Predicate Information (identified by operation id):
       1 - filter("from$_subquery$_002"."rowlimit_$$_rownumber"<=5)
       2 - filter(ROW_NUMBER() OVER ( ORDER BY  NULL )<=5)
    Looking at a CBO trace for the two operations I see signs of a first rows optimization only for the query with the rownum predicate:
    Final query after transformations:******* UNPARSED QUERY IS *******
    SELECT "T"."ID" "ID" FROM "C##TEST"."T" "T" WHERE ROWNUM<=5
    First K Rows: Setup begin
    And so I think there is no first rows optimization for the fetch first clause. Of course the analytics would make an optimization for fast response almost impossible if there is an order in the query since in this case the analytics have to read the complete set before the filtering takes place.
    Regards
    Martin Preiss

  • Display commandButton in some rows only

    In my handler, I created a dynamic datatable. How can I add a command button in some rows only ? I tried to use setRendered but it doesn't work...
    HtmlDataTable _dataTable = new HtmlDataTable();
    _dataTable.setId("table1");
    _dataTable.setVar("table1");       
    _dataTable.setValueBinding("value", application.createValueBinding(#{lpHandler.shpModel}));
    UIColumn _addColumn  = new UIColumn();
    HtmlCommandExButton _addCommand = new HtmlCommandExButton(); 
    String _addAction = "#{hksHandler.editLPOutcome}";
    MethodBinding _addActionBinding = application.createMethodBinding(_addAction,null);
    _addCommand.setAction(_addActionBinding);
    _addCommand.setRendered(_dataTable.getRowIndex() > 0);
    _addColumn.getChildren().add(_addCommand);
    _dataTable.getChildren().add(_addColumn);
    Thanks in Advance

    To expand on this a little more, when you have a data table the components inside the data table only occur once. That is, there is one instance of the command button you have created. During the render process, the subcomponents of the data table are rendered many times, once for each row. What you have done is set the value of the rendered property for the command button once, to whatever static value (_dataTable.getRowIndex() > 0) has at the time you invoke it. So the value for rendered is the same for each row, so you either always get the button or never get the button. In order to make the rendered value dependent on the row, use must set the rendered using a value expression, in the same way you did with the value property for the data table.

  • Automatic Row Processing (DML) - Return Key Into Item

    Hello,
    This question is on Apex 4.2:
    I'm Displaying the [UNIKEY] column value after the record is inserted into the table using :
    page process > process row table_name > Source: Automatic Row Processing (DML) > Return Key Into Item > "Item Name"
    This works fine while inserting records, my question is why this does not respond on update / delete ?
    ϯ LT

    LT
    Check your branches.
    What might be happening is that on insert and update an other branch is followed.
    Where the branch of the insert either isn't clearing the cache of the page or is setting the item with it's own value.
    The branch on the update on the other hand is clearing the cache of the page and not setting the item.
    With a delete there is a clear cache process generate by the wizard. Check if this process is only running on the delete and not on the update.
    From memory the process is called something with reset.
    If the above doesn't help try to replicate the problem on apex.oracle.com and give access with a guest developer account so we can have a look.
    Nicolette

  • How to limit a number of rows to be returned in finder method

    are there any way we can specify the # of rows to be returned in a finder method for an CMP? how should we specify that within the xml configuration files?

    Hi
    Sorry to say that u can't do it in the current versions. Only thing u can do is to get all of them and filter them out at the client or servlet layer.
    For exapmle if u get the Enumeration (say 25 objects), and u want to show 10 at a time. Keep a variable that keep track of the page number (eg whether it's the first 10 set of records nor next). Keep the Enumeraton that u got in the session (so that u don't get it everytime). When next is pressed, depending on the value of the varaible storing page number skip those number of records in the Enumeratin (eg if u are going to the second page, the number of records to skip will be 1*10 = 10, and get records form 11 to 20 and so on........
    What do u say.......this is how I did it in an appilaction.........
    Chandan.

  • Only ints return from SQLite queries with calculations

    Howdy.  Hope I have the right forum for this question.
    I'm on a project using a SQLite database in Flex 4 and I'm using the following SQL query:
    SELECT max(totalScore) AS score,
                   max(longestStreak) AS streakLen,
                   max((correctNotes * 100) / totalNotes) AS accuracyPercent
    FROM main.practiceRecord rec
    JOIN main.lessonSession sess
    ON rec.sessionGuid = sess.guid
    WHERE sess.purchasedLessonID = :lessonId
    The query is working fine as it is written.  The problem is that when I do the calculation ((correctNotes * 100) / totalNotes) to return a percent value, I'd like to do it without having to multiply by 100, since I generally treat percentages as numbers between 0 and 1 (.68 = 68%).  If I don't multiple by 100 in the query, however, I get a "0" for anything less than 1, so only 100% returns with the correct value.  It appears that this kind of calculation only returns an int, as opposed to a REAL (or its AS3 corresponding "Number").
    Is there something that I can do to return a value between 0 and 1 for this percentage so that I don't have to multiply by 100 in the query and then divide by 100 when I get the result?  Is there a function that allows me to specify the precision for the returned value?
    Thanks for your time,
    Bryan

    Maybe Tom Kyte's "trick" of the "select pl_sql_function () from dual" to invoke scalar subquery caching can help you:
    select ename
      from emp, dept
    where (select dname_lookup(emp.deptno) from dual) = 'SALES'
       and dept.deptno = 30
       and emp.deptno = dept.deptno;http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1547006324238
    As Tom says, in 11g you'll be able to cache that function (new 11g feature) which removes the need for the "trick":
    Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1)
    - 8 Using PL/SQL Subprograms
    -- Using the Cross-Session PL/SQL Function Result Cache
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/subprograms.htm#BABFHACJ
    "On the PL/SQL Function Result Cache" by Steven Feuerstein
    http://www.oracle.com/technology/oramag/oracle/07-sep/o57plsql.html
    Regards,
    Zlatko

  • Need Help ::  Current row attribute value returning null

      Hi Frds,
    I am facing the problem that
    Current row attribute value returning null............ even though value is there..... plz.. he
    This is the code in PFR
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
        String  pPersonId = pageContext.getParameter("ctrlPersonId");
         String rowReference = pageContext.getParameter(EVENT_SOURCE_ROW_REFERENCE);
         OptionsVORowImpl curRow = (     OptionsVORowImpl) am.findRowByRef(rowReference);
        String dtlsItem =  (String)curRow.getFlexValue();   /*  this is returning null value */
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks & Regards,
    jaya
    Message was edited by: 9d452cf7-d17f-4d1e-8e0e-b22539ea8810

    Hi Jaya,
    You want to catch Flexfield values?
    Try below code for catch value.
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("queryBtn")!= null)
    OADescriptiveFlexBean dfb = (OADescriptiveFlexBean)webBean.findChildRecursive("flexDFF"); //get the DFF bean
    OAWebBean dffbean = (OAWebBean)dfb.findChildRecursive("flexDFF0"); //get the field that applies to the attribute1 column that is being rendered
    OAMessageStyledTextBean Stylebean = (OAMessageStyledTextBean)dffbean;
    String dtlsItem  = (String)Stylebean.getText(pageContext);
    /*  here creating  the hashmap and calling the page with the hashmap*/
    Thanks,
    Dilip

  • The curser includes a text box from a previous image or link when the curser is positioned on the side of the page. i click and it goes away but only to return again on the next launched page. how do i get rid of this?

    the cursor includes a text box from a previous image or link when the cursor is positioned on the side of the page. it will mainly happen when i hit "back" from the page i was on. i click and it goes away but only to return again on the next launched page. i also keep several tabs open and it will carry over to any one of them i go to. how do i get rid of this?
    == This happened ==
    Every time Firefox opened
    == when i upgraded to most recent version 3.6.8

    A number of extensions can cause that problem, you'll need to do a little troubleshooting to find out which extension is causing that to happen for you.
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

  • ORA-01427:single-row sub query returns more than one row (group by)

    Hello every one, I am very new to this field , and Right now I am working with this sql, where BEG_BAL_WKST,WKST_RECEIVED_NUM,WKST_PROCESSED_NUM,WKST_CANCELED_NUM are needs to be grouped by,but I am getting the "single-row sub query returns more than one row".
    This is the query I am using in my source qualifier:
    select
    SUM(tmp.WIP_TO_BILL_LOC_AMT) AS WIP_TO_BILL_LOC_AMT,
    sum(tmp.REALIZATION_LOC_AMT) AS REALIZATION_LOC_AMT,
    SUM(tmp.NEG_REAL_LOC_AMT) AS NEG_REAL_LOC_AMT,
    sum(tmp.POS_REAL_LOC_AMT) AS POS_REAL_LOC_AMT,
    sum(tmp.BILL_IN_ADVANCE_LOC_AMT) AS BILL_IN_ADVANCE_LOC_AMT,
    sum(tmp.CARRY_FORWARD_LOC_AMT) AS CARRY_FORWARD_LOC_AMT,
    sum(tmp.BILL_TO_CLIENT_LOC_AMT) AS BILL_TO_CLIENT_LOC_AMT,
    sum(tmp.REMAIN_WIP_TO_BILL_LOC_AMT) REMAIN_WIP_TO_BILL_LOC_AMT,
    sum(tmp.AR_INV_AMT) AS AR_INV_AMT,
    sum(tmp.AR_TAX_AMT) AS AR_TAX_AMT,
    tmp.BEG_BAL_WKST_NUM AS BEG_BAL_WKST_NUM,
    tmp.WKST_RECEIVED_NUM AS WKST_RECEIVED_NUM,
    tmp.WKST_PROCESSED_NUM AS WKST_PROCESSED_NUM,
    tmp.WKST_CANCELED_NUM AS WKST_CANCELED_NUM,
    tmp.DURATION AS DURATION,
    tmp.NUM_DAYS AS NUM_DAYS,
    tmp.NUM_HOURS AS NUM_HOURS,
    tmp.NUM_MINUTES AS NUM_MINUTES,
    tmp.NUM_SECONDS AS NUM_SECONDS,
    tmp.LEAD_PROJECT_OFFICE_CODE AS LEAD_PROJECT_OFFICE_CODE,
    tmp.LEAD_PROJECT_TEAM_CODE AS LEAD_PROJECT_TEAM_CODE,
    tmp.ORG_ID AS ORG_ID,
    tmp.RPT_DATE AS RPT_DATE,
    tmp.RPT_DATE_WID AS RPT_DATE_WID,
    tmp.LOCAL_CURR_CODE AS LOCAL_CURR_CODE,
    tmp.USD_EXCH_RATE AS USD_EXCH_RATE,
    tmp.EUR_EXCH_RATE AS EUR_EXCH_RATE,
    tmp.GBP_EXCH_RATE AS GBP_EXCH_RATE
    from(
    SELECT
    WIP_TO_BILL_LOC_AMT as WIP_TO_BILL_LOC_AMT ,
    REALIZATION_LOC_AMT AS REALIZATION_LOC_AMT,
    NEG_REAL_LOC_AMT AS NEG_REAL_LOC_AMT ,
    POS_REAL_LOC_AMT AS POS_REAL_LOC_AMT,
    BILL_IN_ADVANCE_LOC_AMT AS BILL_IN_ADVANCE_LOC_AMT ,
    CARRY_FORWARD_loc_AMT AS CARRY_FORWARD_LOC_AMT,
    bill_to_client_LOC_AMT AS BILL_TO_CLIENT_LOC_AMT ,
    REMAIN_WIP_TO_BILL_LOC_AMT AS REMAIN_WIP_TO_BILL_LOC_AMT,
    AR_inv_AMT AS AR_INV_AMT,
    ar_tax_amt AS AR_TAX_AMT,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE ((inv_status_type='FIN'AND inv_status_code NOT IN ('COMPLETE','PROCESSED'))
    OR (inv_status_type='WS' AND inv_status_code NOT IN ('PRC'))) --COMPLETED
    AND to_char((sysdate-5),'YYYYMMDD') between to_char(status_start_dt,'YYYYMMDD') and to_char(status_end_dt,'YYYYMMDD')group by rpad(integration_id,32)) AS BEG_BAL_WKST_NUM ,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE (inv_status_code='NEW')
    AND to_char((sysdate-4),'YYYYMMDD') between to_char(status_start_dt,'YYYYMMDD') and to_char(status_end_dt,'YYYYMMDD')group by rpad(integration_id,32))AS WKST_RECEIVED_NUM ,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE ((inv_status_type='FIN' and inv_status_code IN ('COMPLETE','PROCESSED'))
    OR (inv_status_type='WS' AND inv_status_code IN ('PRC'))) --COMPLETED
    AND to_char((sysdate-4),'YYYYMMDD') between to_char((status_start_dt),'YYYYMMDD') and to_char((status_end_dt),'YYYYMMDD')group by rpad(integration_id,32))AS WKST_PROCESSED_NUM ,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE (inv_status_type='FIN' AND inv_status_code='CANCELLED')
    AND to_char((sysdate-4),'YYYYMMDD') between to_char((status_start_dt),'YYYYMMDD') and to_char((status_end_dt),'YYYYMMDD')group by rpad(integration_id,32)) AS WKST_CANCELED_NUM,
    DURATION AS DURATION,
    NUM_DAYS AS NUM_DAYS,
    NUM_HOURS AS NUM_HOURS,
    NUM_MINUTES AS NUM_MINUTES,
    NUM_SECONDS AS NUM_SECONDS,
    lead_project_office_code AS LEAD_PROJECT_OFFICE_CODE,
    lead_project_team_code AS LEAD_PROJECT_TEAM_CODE,
    org_id AS ORG_ID,
    trunc(sysdate-1) AS RPT_DATE,
    to_char((sysdate-1),'YYYYMMDD') AS RPT_DATE_WID,
    --last_day(a.report_date) mth_end_dt,
    LOC_CURR_CODE AS LOCAL_CURR_CODE,
    usd_exch_rate AS USD_EXCH_RATE,
    eur_exch_rate AS EUR_EXCH_RATE,
    gbp_exch_rate AS GBP_EXCH_RATE
    FROM Wc_twfs_olb_invoice_history_f
    Where
    RPT_DT_MCAL_PERIOD_WID =(select max(RPT_DT_MCAL_PERIOD_WID)from Wc_twfs_olb_invoice_history_f))tmp
    group by BEG_BAL_WKST_NUM,WKST_RECEIVED_NUM,WKST_PROCESSED_NUM,WKST_CANCELED_NUM,DURATION,NUM_DAYS,NUM_HOURS,NUM_MINUTES,NUM_SECONDS,
    LEAD_PROJECT_OFFICE_CODE,LEAD_PROJECT_TEAM_CODE,ORG_ID,RPT_DATE,RPT_DATE_WID,
    LOCAL_CURR_CODE,USD_EXCH_RATE,EUR_EXCH_RATE,GBP_EXCH_RATE;
    Can you please suggest me what to do next, and what would be the solution to this.
    Thanks a lot in advance. please show me some direction.

    you may want to change it something like
    SELECT SUM(Wip_To_Bill_Loc_Amt) AS Wip_To_Bill_Loc_Amt,
           SUM(Realization_Loc_Amt) AS Realization_Loc_Amt,
           SUM(Neg_Real_Loc_Amt) AS Neg_Real_Loc_Amt,
           SUM(Pos_Real_Loc_Amt) AS Pos_Real_Loc_Amt,
           SUM(Bill_In_Advance_Loc_Amt) AS Bill_In_Advance_Loc_Amt,
           SUM(Carry_Forward_Loc_Amt) AS Carry_Forward_Loc_Amt,
           SUM(Bill_To_Client_Loc_Amt) AS Bill_To_Client_Loc_Amt,
           SUM(Remain_Wip_To_Bill_Loc_Amt) AS Remain_Wip_To_Bill_Loc_Amt,
           SUM(Ar_Inv_Amt) AS Ar_Inv_Amt,
           SUM(Ar_Tax_Amt) AS Ar_Tax_Amt,
           COUNT(DISTINCT CASE
                   WHEN ((Inv_Status_Type = 'FIN' AND
                        Inv_Status_Code NOT IN ('COMPLETE', 'PROCESSED')) OR
                        (Inv_Status_Type = 'WS' AND Inv_Status_Code NOT IN ('PRC'))) --COMPLETED
                        AND To_Char((SYSDATE - 5), 'YYYYMMDD') BETWEEN
                        To_Char(Status_Start_Dt, 'YYYYMMDD') AND
                        To_Char(Status_End_Dt, 'YYYYMMDD') THEN
                    Rpad(Integration_Id, 32)
                 END) AS Beg_Bal_Wkst_Num,
           /*(SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE ((Inv_Status_Type = 'FIN' AND
                   Inv_Status_Code NOT IN ('COMPLETE', 'PROCESSED')) OR
                   (Inv_Status_Type = 'WS' AND Inv_Status_Code NOT IN ('PRC'))) --COMPLETED
               AND To_Char((SYSDATE - 5), 'YYYYMMDD') BETWEEN
                   To_Char(Status_Start_Dt, 'YYYYMMDD') AND
                   To_Char(Status_End_Dt, 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Beg_Bal_Wkst_Num,
           (SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE (Inv_Status_Code = 'NEW')
               AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
                   To_Char(Status_Start_Dt, 'YYYYMMDD') AND
                   To_Char(Status_End_Dt, 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Received_Num,
           (SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE ((Inv_Status_Type = 'FIN' AND
                   Inv_Status_Code IN ('COMPLETE', 'PROCESSED')) OR
                   (Inv_Status_Type = 'WS' AND Inv_Status_Code IN ('PRC'))) --COMPLETED
               AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
                   To_Char((Status_Start_Dt), 'YYYYMMDD') AND
                   To_Char((Status_End_Dt), 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Processed_Num,
           (SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE (Inv_Status_Type = 'FIN' AND Inv_Status_Code = 'CANCELLED')
               AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
                   To_Char((Status_Start_Dt), 'YYYYMMDD') AND
                   To_Char((Status_End_Dt), 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Canceled_Num,*/
           Duration AS Duration,
           Num_Days AS Num_Days,
           Num_Hours AS Num_Hours,
           Num_Minutes AS Num_Minutes,
           Num_Seconds AS Num_Seconds,
           Lead_Project_Office_Code AS Lead_Project_Office_Code,
           Lead_Project_Team_Code AS Lead_Project_Team_Code,
           Org_Id AS Org_Id,
           Trunc(SYSDATE - 1) AS Rpt_Date,
           To_Char((SYSDATE - 1), 'YYYYMMDD') AS Rpt_Date_Wid,
           --last_day(a.report_date) mth_end_dt,
           Loc_Curr_Code AS Local_Curr_Code,
           Usd_Exch_Rate AS Usd_Exch_Rate,
           Eur_Exch_Rate AS Eur_Exch_Rate,
           Gbp_Exch_Rate AS Gbp_Exch_Rate
      FROM Wc_Twfs_Olb_Invoice_History_f
    WHERE Rpt_Dt_Mcal_Period_Wid =
           (SELECT MAX(Rpt_Dt_Mcal_Period_Wid)
              FROM Wc_Twfs_Olb_Invoice_History_f)
    GROUP BY Beg_Bal_Wkst_Num,
              Wkst_Received_Num,
              Wkst_Processed_Num,
              Wkst_Canceled_Num,
              Duration,
              Num_Days,
              Num_Hours,
              Num_Minutes,
              Num_Seconds,
              Lead_Project_Office_Code,
              Lead_Project_Team_Code,
              Org_Id,
              Rpt_Date,
              Rpt_Date_Wid,
              Local_Curr_Code,
              Usd_Exch_Rate,
              Eur_Exch_Rate,
              Gbp_Exch_Rate;Edited by: 986006 on Mar 4, 2013 1:08 PM

Maybe you are looking for