Issue using cursors in extractors

Hello,
I am using two cursors in an extractor. My requirement is to delete data obtained from one cursor from another set of data obtained from the second cursor.
What happens is when the two cursors run for the first time, assuming they read 100 records each, if the data i require to delete from the second cursor is not in the first set of records obtained from the first cursor, then on the second run, the data would be replaced by new data in both the tables and this time, even though the data is available in the second cursor, the data in the first has been replaced already. So the requirement doesnt get fulfilled.
If anyone could make sense of what i just wrote , pls help me out.
Regards,
Suraj

Hi Suraj,
The thing is you cannot raise the exception when there is not data fetch in the first cursor select statement.
As you dont know at run time is there any data left in the second select statement you have written .
what you can do if declare a variable which will be set to X when the sy-subrc<> 0 for the first select statment.
like
This is your 1st select statement with the cursor .....
    FETCH NEXT CURSOR S_CURSOR
               APPENDING CORRESPONDING FIELDS
               OF TABLE E_T_DATA
               PACKAGE SIZE S_S_IF-MAXSIZE.
    IF SY-SUBRC <> 0.
lv_var = 'X' .
Dont raise the ecception here.
    ENDIF.
No the 2nd select statment with cursor
    FETCH NEXT CURSOR S_CURSOR
               APPENDING CORRESPONDING FIELDS
               OF TABLE E_T_DATA
               PACKAGE SIZE S_S_IF-MAXSIZE.
    IF SY-SUBRC <> 0.
if lv_var = 'X' .
raise the ecception here this is because in the 1st select it has already fetch all the data .
endif.  
ENDIF.
where you lv_var is type c .
I hope it is clear now.
Regards,
Pawan
Message was edited by:
        PS

Similar Messages

  • Performanace Issue using cursors

    Hi All,
    I am using Cursors in my db using these cursors i am fetching data from 8 DB's. When it was fresh Database It was working fine. But now it is taking lot of time. I have a Stats on all the tables. How we can increase the performance of that program so that we can get the data in my db at high speed. we are using simple cursors. Can i use ref cursors for incresing the performance.
    Thanks in advance

    Hi,
    I am from india, Working for a Telecom Company. we have 12 databases and now we have created some pl/sql programs on my host database. I have shcedule these programs at 3 o'clock night now. we are facing some performance problem. we want these programs should complete within 2 hours. but they are taking huge time.near about 4hours. the coding of this proc is below.
    CURSOR C1 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu1 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C2 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu2 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C3 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu3 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C4 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu4 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C5 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu5 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C6 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu6 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C7 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu7 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR c_active_brio_demo is
    select /*+ INDEXED */ mtdd.first_order_cr_date,
    mtdd.USER_ID,
    mtdd.account_no,
    mtdd.BILL_FIRST_NAME,
    mtdd.BILL_MIDDLE_NAME,
    mtdd.BILL_LAST_NAME,
    mtdd.BILL_ADDRESS_1,
    mtdd.BILL_ADDRESS_2,
    mtdd.bill_address_3,
    mtdd.BILL_CITY,
    mtdd.bill_state,
    mtdd.bill_zip,
    mtdd.bill_period,
    mtdd.CONTACT1_PHONE,
    mtdd.contact2_phone,
    mtdd.cust_phone1,
    mtdd.cust_phone2,
    mtdd.ACCOUNT_ACTIVATION_DATE,
    mtdd.ACCOUNT_CREATION_DATE,
    mtdd.ACCOUNT_STATUS,
    mtdd.DEALER_NAME,
    MTDD.ALLOC_AGENT_CODE,
    mtdd.ACCOUNT_CATEGORY,
    mtdd.parent_id,
    mtdd.bill_county,
    mtdd.EQUIP_STATUS,
    mtdd.MARKET_CODE,
    mtdd.subscriber_no,
    mtdd.subscriber_no_reset,
    mtdd.report_id,
    mtdd.report_date,
    mtdd.rec_type,
    mtdd.addon_name,
    mtpd.PACKAGE_NAME,
    mtpd.ACTIVE_DATE P_ACTIVE_DATE,
    mtpd.INACTIVE_DATE P_INACTIVE_DATE,
    MTPD.PACKAGE_ORDER_ID,
    nvl(osv.display_value,'UNDEFINED') PACKAGE_ORDER_STATUS,
    mtpd.package_status,
    mtpd.package_instance_id,
    mtpd.package_instance_id_serv,
    mtcd.COMPONENT_NAME,
    mtcd.ACTIVE_DATE,
    mtcd.INACTIVE_DATE,
    mtcd.COMPONENT_STATUS,
    mtdd.subdealer_code,
    mtdd.DISCONNECT_REASON,
    mtdd.XFER_REASON,
    mtdd.CONNECT_RESON,
    MONTHS_BETWEEN(mtdd.SERVICE_END,mtdd.SUBSCR_ACTIVATION_DATE) AON
    from misr_tra_demo_det mtdd,misr_tra_pack_det mtpd, misr_tra_comp_det mtcd,order_status_values osv
    where mtdd.report_id = p_rep_id
    and mtpd.subscriber_no = mtdd.subscriber_no
    and mtpd.subscriber_no_resets = mtdd.subscriber_no_reset
    and mtpd.report_id = mtdd.report_id
    and mtpd.record_type = mtdd.rec_type
    and mtcd.subscriber_no = mtdd.subscriber_no
    and mtcd.subscriber_no_resets = mtdd.subscriber_no_reset
    and mtcd.report_id = mtdd.report_id
    and mtcd.record_type = mtdd.rec_type
    and mtcd.package_instance_id = mtpd.package_instance_id
    and mtcd.package_instance_id_serv = mtpd.package_instance_id_serv
    and mtpd.PACKAGE_ORDER_STATUS = osv.ORDER_STATUS(+);
    CURSOR CUR_VAS IS
    SELECT distinct mmvc.COMPONENT_NAME
    FROM misr_mas_vas_comp mmvc, misr_tra_comp_det mtcd
    WHERE mtcd.subscriber_no = d_subscriber_no
    AND mtcd.subscriber_no_resets = d_subscriber_no_reset
    AND mtcd.inactive_date = E_END_DATE
    AND mtcd.component_id = mmvc.component_id;
    CURSOR c_active_brio_equip is
    select /*+ INDEXED */ mted.MOBILE_ORDER_ID,
    MTED.MOBILE_ORDER_STATUS,
    mted.EXTERNAL_ID,
    mted.START_DATE,
    mted.END_DATE,
    mted.external_id_type,
    MONTHS_BETWEEN(mted.END_DATE,mted.ORIG_SERVICE_START) AON
    from misr_tra_equip_det mted
    where subscriber_no = d_subscriber_no
    and subscriber_no_resets = d_subscriber_no_reset
    and report_id = p_rep_id
    and rec_type = d_rec_type;CURSOR C1 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu1 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C2 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu2 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C3 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@bpcu3 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C4 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@bpcu4 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C5 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@bpcu5 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C6 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu6 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR C7 IS
    select bill_ref_no , (NEW_CHARGES/100)
    from cmf_balance@cu7 a
    where ACCOUNT_NO = D_ACCOUNT_NO
    ORDER BY BILL_REF_NO DESC;
    CURSOR c_active_brio_demo is
    select /*+ INDEXED */ mtdd.first_order_cr_date,
    mtdd.USER_ID,
    mtdd.account_no,
    mtdd.BILL_FIRST_NAME,
    mtdd.BILL_MIDDLE_NAME,
    mtdd.BILL_LAST_NAME,
    mtdd.BILL_ADDRESS_1,
    mtdd.BILL_ADDRESS_2,
    mtdd.bill_address_3,
    mtdd.BILL_CITY,
    mtdd.bill_state,
    mtdd.bill_zip,
    mtdd.bill_period,
    mtdd.CONTACT1_PHONE,
    mtdd.contact2_phone,
    mtdd.cust_phone1,
    mtdd.cust_phone2,
    mtdd.ACCOUNT_ACTIVATION_DATE,
    mtdd.ACCOUNT_CREATION_DATE,
    mtdd.ACCOUNT_STATUS,
    mtdd.DEALER_NAME,
    MTDD.ALLOC_AGENT_CODE,
    mtdd.ACCOUNT_CATEGORY,
    mtdd.parent_id,
    mtdd.bill_county,
    mtdd.EQUIP_STATUS,
    mtdd.MARKET_CODE,
    mtdd.subscriber_no,
    mtdd.subscriber_no_reset,
    mtdd.report_id,
    mtdd.report_date,
    mtdd.rec_type,
    mtdd.addon_name,
    mtpd.PACKAGE_NAME,
    mtpd.ACTIVE_DATE P_ACTIVE_DATE,
    mtpd.INACTIVE_DATE P_INACTIVE_DATE,
    MTPD.PACKAGE_ORDER_ID,
    nvl(osv.display_value,'UNDEFINED') PACKAGE_ORDER_STATUS,
    mtpd.package_status,
    mtpd.package_instance_id,
    mtpd.package_instance_id_serv,
    mtcd.COMPONENT_NAME,
    mtcd.ACTIVE_DATE,
    mtcd.INACTIVE_DATE,
    mtcd.COMPONENT_STATUS,
    mtdd.subdealer_code,
    mtdd.DISCONNECT_REASON,
    mtdd.XFER_REASON,
    mtdd.CONNECT_RESON,
    MONTHS_BETWEEN(mtdd.SERVICE_END,mtdd.SUBSCR_ACTIVATION_DATE) AON
    from misr_tra_demo_det mtdd,misr_tra_pack_det mtpd, misr_tra_comp_det mtcd,order_status_values osv
    where mtdd.report_id = p_rep_id
    and mtpd.subscriber_no = mtdd.subscriber_no
    and mtpd.subscriber_no_resets = mtdd.subscriber_no_reset
    and mtpd.report_id = mtdd.report_id
    and mtpd.record_type = mtdd.rec_type
    and mtcd.subscriber_no = mtdd.subscriber_no
    and mtcd.subscriber_no_resets = mtdd.subscriber_no_reset
    and mtcd.report_id = mtdd.report_id
    and mtcd.record_type = mtdd.rec_type
    and mtcd.package_instance_id = mtpd.package_instance_id
    and mtcd.package_instance_id_serv = mtpd.package_instance_id_serv
    and mtpd.PACKAGE_ORDER_STATUS = osv.ORDER_STATUS(+);
    CURSOR CUR_VAS IS
    SELECT distinct mmvc.COMPONENT_NAME
    FROM misr_mas_vas_comp mmvc, misr_tra_comp_det mtcd
    WHERE mtcd.subscriber_no = d_subscriber_no
    AND mtcd.subscriber_no_resets = d_subscriber_no_reset
    AND mtcd.inactive_date = E_END_DATE
    AND mtcd.component_id = mmvc.component_id;
    CURSOR c_active_brio_equip is
    select /*+ INDEXED */ mted.MOBILE_ORDER_ID,
    MTED.MOBILE_ORDER_STATUS,
    mted.EXTERNAL_ID,
    mted.START_DATE,
    mted.END_DATE,
    mted.external_id_type,
    MONTHS_BETWEEN(mted.END_DATE,mted.ORIG_SERVICE_START) AON
    from misr_tra_equip_det mted
    where subscriber_no = d_subscriber_no
    and subscriber_no_resets = d_subscriber_no_reset
    and report_id = p_rep_id
    and rec_type = d_rec_type;
    Please suggest me how we can improve the performance can we use pl/sql records over here.

  • Static internal table issue - Used in BI Extractor

    Hi,
      We are reading data from a table in to a static internal table and using this table for future lookups.
      Once in a while we can't find data while doing a lookup from this static internal table , But most of the time it works.
       Is it possible that data from this static internal table is removed due to memory issues during peak periods.
    Thanks in advance

    Here is the code and it is there in a function module.This function module is called from a different FM in a loop.
    TABLES: OIU_CM_MAT_PRCD.
      STATICS: i_mat_prcd LIKE OIU_CM_MAT_PRCD OCCURS 10 WITH HEADER LINE.
      DATA: ws_lines like sy-toccu.
      DESCRIBE TABLE i_mat_prcd LINES ws_lines.
      IF ws_lines = 0.
        SELECT * INTO TABLE i_mat_prcd
          FROM OIU_CM_MAT_PRCD.
        IF i_matnr > ' '.
          SORT i_mat_prcd BY matnr.
        ELSE.
          SORT i_mat_prcd BY majpd_cd pd_cd.
        ENDIF.
      ENDIF.
      IF i_matnr > ' '.
        READ TABLE i_mat_prcd WITH KEY matnr = i_matnr
           BINARY SEARCH.
        IF SY-SUBRC = 0.
          CHG_MAJOR = i_mat_prcd-MAJPD_CD.
          CHG_MINOR = i_mat_prcd-PD_CD.
          CONCATENATE i_mat_prcd-majpd_cd i_mat_prcd-pd_cd
             INTO chg_prod.
        ENDIF.    " i_matnr > blank

  • Cursors in extractors

    Hello,
    I have a extractor function module as follows
    FUNCTION YYYY.
    *----- Initialization mode (first call by SAPI) or data transfer mode
    *----- (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
      <code>
      ELSE.                 "Initialization mode or data extraction ?
        CALL FUNCTION 'XXXX'
             EXPORTING
             IMPORTING
             TABLES
             EXCEPTIONS
                  NO_MORE_DATA       = 1
        if sy-subrc = 1.
          RAISE NO_MORE_DATA.
        endif.
    ABCD----
    >
      ENDIF.
    ENDFUNCTION.
    Here my function module XXXX uses cursors to get some data from the backend tables. This is done using repeated calls of the function module till the exception no_more_data is obtained.
    Now my issue is that i need to extract another set of data in the same function module using cursors again at the mentioned point in code, ABCD. How can i do this, keeping in mind the multiple function module calls?
    Regards,
    Suraj

    Hi Suraj,
    The thing is you cannot raise the exception when there is not data fetch in the first cursor select statement.
    As you dont know at run time is there any data left in the second select statement you have written .
    what you can do if declare a variable which will be set to X when the sy-subrc<> 0 for the first select statment.
    like
    This is your 1st select statement with the cursor .....
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
    lv_var = 'X' .
    Dont raise the ecception here.
        ENDIF.
    No the 2nd select statment with cursor
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
    if lv_var = 'X' .
    raise the ecception here this is because in the 1st select it has already fetch all the data .
    endif.  
    ENDIF.
    where you lv_var is type c .
    I hope it is clear now.
    Regards,
    Pawan
    Message was edited by:
            PS

  • How to use cursor function for nested xml

    Hi,
    i have a query for XMLQuery like
    select * from bills where bill_id=????
    it results in something like
    <bills>
    <bill>
    <city>london</city>
    <amount>44</amount>
    </bill>
    <bill>
    <city>london</city>
    <amount>988</amount>
    </bill>
    <bill>
    <city>new york</city> <amount>59</amount> </bill>
    </bills>
    but i want xml output to be sorted for city names adding one more level location like
    <bills>
    <location city="london">
    <bill>
    <amount>44</amount>
    </bill>
    <bill>
    <amount>988</amount> </bill>
    </location>
    <location city="new york">
    <bill>
    <amount>59</amount> </bill>
    </location>
    </bills>
    it should be possible to iterate through the same table to gather informaton with the help of cursor function, but never used CURSOR before.
    any idea?

    sreese wrote:
    p_desig works as a comma delimited string without the NVL function, that's not the issue.
    It IS the issue .. you need to provide  a SAMPLE so we can see what you're doing ..
    How are you "passing it in" ?
    option A:
    procedure ( in_var  in  VARCHAR2 )
    AS
    and nvl(sn.c_attribute1,'x@#$%') in nvl(in_var,'x@#$%')
    option B:
    and nvl(sn.c_attribute1,'x@#$%') in nvl(&1,'x@#$%')
    .. or some other method?

  • Need using cursor for query

    Hi all,
    can anybody tell me how to get the result of the following query by using cursor?
    SELECT (SUBSTR('        ', 1,LEVEL*2)
      || t1.label) AS t1_label,
      amount
    FROM
      (SELECT t1.label,
        t1.ID,
        t1.parent_id,
        SUM(t2.turnover) AS amount
      FROM t1,
        t2
      WHERE t2.t1_id = t1.id
      AND t2.t1_id  IN
        (SELECT id
        FROM t1
          START WITH t1.ID       = 2
          CONNECT BY PRIOR t1.ID = t1.parent_id
      GROUP BY t1.label, t1.ID, t1.parent_id
      ) t1
      START WITH t1.ID       = 2
      CONNECT BY PRIOR t1.ID = t1.parent_id;...and the result:
    t1_label             amount
         B11     11778.54
          B121     19980.28
            B1211     18842.77
            B1212     25480.56
          B122     18339.07
        B12            23455.9
        B13            20876.52Thanks,
    Alex
    Edited by: 860003 on Jun 9, 2011 1:30 AM
    Edited by: 860003 on Jun 9, 2011 1:31 AM
    Edited by: 860003 on Jun 9, 2011 1:31 AM

    860003 wrote:
    Is not that i don't want to use hierarchy queries, but find others ways, tricks to reach the result needed. I just want to explore different ways that Oracle provides to resolve issues.Not a problem with that in principle.
    Maybe using "loop, if-else, for" will provide us with an elegant way to get the result. However, a problem in principle with this. SQL and PL/SQL are not the same thing. Two separate and very different languages.
    In PL/SQL, you can code both PL and SQL - so you can write source code of 2 different language and mix these. The PL/SQL parser is clever enough to figure out what is what and glues the code seamlessly and transparently together.
    SQL is used to crunch SQL data. PL/SQL sucks at this in comparison (and Java/.Net sucks a heck of a lot worse at this). Cursor fetch loops? Bulk processing. Neat. But will always be slower than running that data crunching in SQL only.
    That is why there is a simple maxim for performance in Oracle: Maximise SQL. Minimise PL/SQL.
    Do not use PL/SQL to do what the SQL is perfectly able and capable of doing. The exception is when the processing is too complex for SQL to handle and you need the programming logic part of the PL/SQL language.
    My question is how to use this cursor to get the value, fetch it and then get another value(ofc only for the children) and fetch it again so i can output it? I thing this can be achieve but don't know how.All SQLs (and anonymous PL/SQL) are parsed and cursors are created. A cursor is a basically a set of instructions (as seen via execution plans) of how to get the job done. Think of cursors as programs that are executed and output data.
    So do you want t create a bunch of cursors (programs) and then call these from PL/SQL, consume their output, create/call new cursor programs and repeat?
    Or do you want to create a single cursor program that does the job and outputs the required results?
    Maximise SQL. Minimise PL/SQL.

  • Insert multiple rows using Cursors.

    I am trying to insert rows into a table based on information from another table.
    For example:
    When Table 1: Num_Rows = 100 my proc will insert 100 rows into Table 2 with relevent data.
    Do I need to use a Cursor and iterate through Num_Rows doing an INSERT each time? Is there a better way to do it other than using Cursors?
    Rob.

    It is not about using cursors or not using cursors. All SQLs wind up as cursors in the Oracle Shared Pool. So there is no such concept as not using cursors. Oracle needs to parse and compile and execute SQLs as cursors.
    The issue is WHERE* you do the work?
    Do you use the cursor (SQL) to do it for you? Or do you pull the data into another language, like PL or Java and process it there?
    And the performance mantra in this case is a very fundemantal Maximize SQL and minimize PL/Java/etc+.
    So do not do in PL/SQL what you can do in SQL only. It is a lot slower to pull data from the SQL engine into the PL engine. And then push that very same data from the PL engine back to the SQL engine. Like the following for example:
    -- poor design, poor performance
    for employee in (select e.* from emp e where e.deptid = 123 )
    loop
      insert into tab2 values( employee.empid, employee.name );
    end loop;You do not need to use PL (or Java) in this case. The SQL language is more than able to do this better and faster than any other language... as it is closer to the data.
    So the following is far more optimal code. Instead of the above PL/SQL code, we can simply do it as:
    -- optimal design: maximizing SQL and letting it to as much of the work as possible
    insert into tab2 select e.empid, e.name from emp e where e.deptid = 123;

  • Issues using ContinuousQueryCaches in Coherence 3.5

    Hi,
    I'm hitting some issues using ContinuousQueryCaches in Coherence 3.5.
    I am trying to use a PofExtractor with a filter on a ContinuousQueryCache and I am getting the following exception:
    java.lang.UnsupportedOperationException: PofExtractor must be used with POF-encoded Binary entries; the Map Entry is not a BinaryEntry
    at com.tangosol.util.extractor.PofExtractor.extractFromEntry(PofExtractor.java:157)
    at com.tangosol.util.InvocableMapHelper.extractFromEntry(InvocableMapHelper.java:292)
    at com.tangosol.util.filter.ExtractorFilter.evaluateEntry(ExtractorFilter.java:94)
    at com.tangosol.util.InvocableMapHelper.evaluateEntry(InvocableMapHelper.java:260)
    at com.tangosol.util.InvocableMapHelper.query(InvocableMapHelper.java:382)
    at com.tangosol.net.cache.ContinuousQueryCache.entrySet(ContinuousQueryCache.java:746)
    at com.myproject.getItem(MyClass.java:400)
    The code I am using to generate this exception is similar to this:
    ContinuousQueryCache queryCache = new ContinuousQueryCache(namedCache, new InFilter(new PofExtractor(Long.class, ItemSerializer.PARENT_ID_FIELD), filteredIds));
    // filter to pull back objects only where the parent id of object matches provided value
    Filter filter = new EqualsFilter(new PofExtractor(Long.class, ItemSerializer.PARENT_ID_FIELD), parentId);
    Set<Item> children = new HashSet<Item>();
    Set<Map.Entry<String, Item>> set = queryCache.entrySet(filter); // this line throws Exception
    Does anyone know why this might be occurring?
    Many Thanks

    Hi,
    This looks like an issue that was fixed in 3.5.3 & 3.6 and backported to 3.5.2 patch 2...
    ContinuousQueryCache & Filters using PofExtractor
    Re: Can you run continuous queries via Java Extend
    Thanks,
    Tom

  • Generate report using CURSORS? - Simple question

    Folks,
    I'm a real newbie still with PL/SQL so please excuse my ignorance I have a simple report I need to generate. The following SQL statement gets me all my "header" records:
    SELECT OHA.ORDER_NUMBER, HEADER_ID, ATT11, ATT12, ATT16
    FROM XXXWD.WD_DUPS DUPS, OE_ORDER_HEADERS_ALL OHA
    WHERE OHA.ATTRIBUTE11 = DUPS.ATT11
    AND OHA.ATTRIBUTE12 = DUPS.ATT12
    AND OHA.ATTRIBUTE16 = DUPS.ATT16
    AND (OHA.FLOW_STATUS_CODE NOT IN ('CLOSED', 'CANCELLED'))
    AND (ATT11 <> 'WESTERN SERVICE')
    ORDER BY ATT11, ATT12, ATT16
    What I want to do now is have a second script that will display all my detail records. Something like:
    SELECT OLA.LINE_NUMBER, OLA.ORDERED_ITEM, OLA.FLOW_STATUS_CODE
    FROM OE.ORDER_LINES_ALL OLA
    WHERE OLA.HEADER_ID = OHA.HEADER_ID
    I expect I'd do this with two cursors, passing the value of my HEADER_ID to my second cursor. But when I've used cursors before, they primarily have been to import data, and manipulate data. But what if I just want to create a report using these?
    I essentially want to display my header information, and then any lines below that data (if there is any, there may be a header with no lines).
    Can I create a simple report like this with cursors? Any help with this would be IMMENSELY appreciated. I'm really under the gun... :)
    Thanks so much!
    Steve

    Here's one query that will give you everything:
    SELECT OHA.ORDER_NUMBER
          ,OHA.HEADER_ID
          ,DUPS.ATT11
          ,DUPS.ATT12
          ,DUPS.ATT16
          ,OLA.LINE_NUMBER
          ,OLA.ORDERED_ITEM
          ,OLA.FLOW_STATUS_CODE     
    FROM   XXXWD.WD_DUPS        DUPS
          ,OE_ORDER_HEADERS_ALL OHA
          ,OE.ORDER_LINES_ALL   OLA
    WHERE  OLA.HEADER_ID   = OHA.HEADER_ID
    AND    OHA.ATTRIBUTE11 = DUPS.ATT11
    AND    OHA.ATTRIBUTE12 = DUPS.ATT12
    AND    OHA.ATTRIBUTE16 = DUPS.ATT16
    AND    OHA.FLOW_STATUS_CODE NOT IN ('CLOSED', 'CANCELLED')
    AND    DUPS.ATT11 <> 'WESTERN SERVICE'
    ORDER  BY OHA.ORDER_NUMBER
             ,OLA.LINE_NUMBER
             ,DUPS.ATT11
             ,DUPS.ATT12
             ,DUPS.ATT16
    ;(correction in order by clause)
    Message was edited by:
    Eric H

  • To Use  Cursor or  TYPE table Index by PLS_integer

    Hi All,
    Let's see if I have table with no. of records 19,26,20,000.
    If I want to loop through all the records which will be a optimized way To Use Cursor or TYPE table Index by PLS_integer.
    Please guide.
    Thanks.

    What is it you want to do to/with the rows you're looping through?
    Ideally you want to avoid looping, as that's row by row (aka slow by slow) processing and it's expensive time-wise.
    If you're doing DML (insert/update/delete) then you're best off doing it in one sql statement, rather than looping.

  • How to pick max value from a column of a table using cursor and iteration

    Hello Everybody
    I have a table loan_detail
    and a column in it loan_amount
    now i want to pick values from this table using cursor and then by using iteration i want to pick max value from it using that cursor
    here is my table
    LOAN_AMOUNT
    100
    200
    300
    400
    500
    5600
    700i was able to do it using simple loop concepts but when i was trying to do this by using cursor i was not able to do it .
    Regards
    Peeyush

    SQL> SELECT MAX(sal) Highest_Sal,MIN(sal) Lowest_Sal FROM emp;
    HIGHEST_SAL LOWEST_SAL
           5000        800
    SQL> set serverout on
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := counter;
    10      counter := counter + 1;
    11    END LOOP;
    12    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    13    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    14  END;
    15  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Even smaller
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := 1;
    10    END LOOP;
    11    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    12    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    13  END;
    14  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Edited by: Saubhik on Jan 5, 2011 4:41 PM

  • Any way to use cursor values inside other cursor by bulk collect?

    hi,
    Is there any way to use cursor get_tables value insdide loop get column if i am using bulk collect in both cursors?
    I tried a lot but i am nt able to do it.kindly help...
    create or replace procedure MULTIPLE_CURSORS_PROC is
    v_owner varchar2(40);
    v_table_name varchar2(40);
    v_column_name varchar2(100);
    cursor get_tables is
    select distinct tbl.owner, tbl.table_name
    from all_tables tbl
    where tbl.owner = 'SYSTEM';
    cursor get_columns is
    select distinct col.column_name
    from all_tab_columns col
    where col.owner = v_owner
    and col.table_name = v_table_name;
    begin
    open get_tables;
    loop
    fetch get_tables into v_owner, v_table_name;
    open get_columns;
    loop
    fetch get_columns into v_column_name;
    end loop;
    close get_columns;
    end loop;
    close get_tables;
    end ;

    hi there
    Refer this
    CREATE OR REPLACE PROCEDURE MULTIPLE_CURSORS_PROC
    IS
       TYPE scol IS VARRAY (10000) OF VARCHAR2 (32767);
       v_table_name    scol;
       v_column_name   scol;
       TYPE curtyp IS REF CURSOR;
       get_columns     curtyp;
       CURSOR get_tables
       IS
          SELECT   DISTINCT tbl.table_name
            FROM   all_tables tbl
           WHERE   tbl.owner = 'SYSTEM';
    BEGIN
       OPEN get_tables;
       LOOP
          FETCH get_tables BULK COLLECT INTO   v_table_name;
          FOR indx IN v_table_name.FIRST .. v_table_name.LAST
          LOOP
             SELECT   DISTINCT col.column_name
               BULK   COLLECT
               INTO   v_column_name
               FROM   all_tab_columns col
              WHERE   col.table_name = v_table_name (indx);
             FOR ind IN v_column_name.FIRST .. v_column_name.LAST
             LOOP
                DBMS_OUTPUT.put_line (v_column_name (ind));
             END LOOP;
          END LOOP;
          EXIT WHEN get_tables%NOTFOUND;
       END LOOP;
       CLOSE get_tables;
    END MULTIPLE_CURSORS_PROC;regards
    Hitesh

  • Report using cursors and loop

    Hi,
    can anybody suggest what kind of report and in what way I have to use if I want to write query using cursors within loops?
    Thanks!
    Karina.

    Hi,
    I found the solution. I just rewrite all cursors within one SQL statement and it works.
    Karina.

  • Using Cursor in Select statements? How to do this?

    I am getting an error whilt passing a cursor to a select clause:
    SELECT dbms_xmlquery.getXML('select deptno, dname, '||
    'cursor(select empno, ename, sal from emp e where e.deptno = d.deptno) employees '||
    'from dept d where d.deptno in (10, 20)')
    FROM dual;
    DBMS_XMLQUERY.GETXML('SELECTDEPTNO'||'CURSORIS(SELECTEMPNOFROMEMPEWHEREE.DEPT=D.
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: ORA-00923
    : FROM keyword not found where expected
    </ERROR
    THIS IS DUE TO THE CURSOR AND ITS FROM STATEMENT?
    CAN ANY ONE PLEASE GUIDE AS TO HOW TO USE CURSORS IN A SELECT STATEMENT PLEASE?

    Another duplicate thread. See my response Select CLAUSE error using CURSORS & XSU.Please SEE..
    Cheers, APC

  • Loading data from one table to another using cursor

    Hi,
    I have given the below command to load the data from 1 table to another using cursor.
    declare
    cursor mycursor IS
    SELECT extract_name,from_date,to_date,BETA from temp_table where EXTRACT_NAME='GIFTCARD_DETAILS';
    Begin
    for mycursor_1 IN mycursor loop
    insert into tmp_tab columns(col1,col2,col3,col5) values(mycursor_1.EXTRACT_NAME,mycursor_1.from_date,mycursor_1.to_date,mycursor_1.BETA);
    End loop;
    commit;
    end;
    It is working fine.
    But I want to hard code some of the columns ( like flags ) which are not there in 1st table and load them into 2nd table.
    In db2 we will give commands like
    varSqlStatus=`db2 "declare mycurs cursor for select extract_name,from_date,to_date,BETA,'N','Y' from temp_table"`
    varSqlStatus=`db2 "load from mycurs of cursor modified by identityignore insert into tmp_tab(col1,col2,col3,col5,col6,col7) nonrecoverable"`
    But I want it in oracle 10g, Can any one help me in this.

    Have you tried either of the two options :
    1. Modify the CURSOR itself :
    cursor mycursor IS
    SELECT extract_name,from_date,to_date,BETA,'N','Y' from temp_table where EXTRACT_NAME='GIFTCARD_DETAILS';2. Modify the INSERT statement itself :
    insert into tmp_tab columns(col1,col2,col3,col5,col6,col7) values(mycursor_1.EXTRACT_NAME,mycursor_1.from_date,mycursor_1.to_date,mycursor_1.BETA,'N','Y');

Maybe you are looking for

  • Sharepoint foundation and server 2013

    hi all i have scom 2012 sp1 on windows server 2008 r2. sql reporting services (mssql 2012 sp1) installed and configured on this server. OM, OMDW, scom`s reportserver db - on other server 2008 r2 (mssql 2012 sp1). i try to install management pack shar

  • The document "anything" cannot be opened

    So a few years ago I bought iWork and moved all of my life's work into Pages. Then I took a break for a while, came back, and Pages no longer will open any files. Every attempt gives me "The document 'whatever' cannot be opened". These are all files

  • OC4J hangs when accessing ADF DataPage

    My application was working and all of a sudden, when I try to hit a DataPage accessing a table (Read Only on the JSP side) it hangs. If I try to hit any page after that using the same session is hangs up also. After debugging and stepping through a l

  • Question about the order to creating Account, Contact, Contact Role

    Hi, my friends, I have some questions about the order of creating Account, Contact, Contact Role, etc in Web Service 1.0. I could create them in the following case: 1. Insert Contact object and get contactId (now new contact exists in CRMOD) 2. Inser

  • Regarding Java Speech APIs

    Hey, Can i know where do i find java speech API kit for download...can any one help me...it's urgent?