Issue with FETCH CURSOR

Dear All,
In one of the standard program the following code is used
FETCH NEXT CURSOR c_handle-db_cursor
        INTO CORRESPONDING FIELDS OF l_s_ce0_enh.
Here the problem is sometimes at this line program getting timed out and gives dump as time limit exceeded.l_s_ce0_enh is workarea.
Please let me know the solution for this.
Regards
Shoban

In 10g,
FOR r IN c LOOPis optimized by the compiler into a bulk-fetch operation, whereas
OPEN c;
LOOP
    FETCH c INTO r;
    EXIT WHEN c%NOTFOUND;
    etc...is not.
If your analysis shows that fetching from the cursor is where most of the time goes, it's possible the query itself needs optimising. Or it could be that it just has a lot of rows to work on and it's performing the best it can.
However, the whole cursor loop approach is inherently slower than a single SQL statement, so depending on what processing you need to perform inside the loop it may be possible to replace the whole thing with one INSERT or MERGE etc. Or as others have suggested you might explicitly bulk collect a couple of hundred rows at a time into a collection, and apply your INSERT/UPDATE/DELETE etc processing in FORALL statements using the collection.

Similar Messages

  • Problem with fetch cursor statement

    Hi,
    I am using FETCH CURSOR statement to fetch the data from a database table with package size. For the fetched records I am doing parallel processing using parallel processing frame work in banking system.
    Here the problem is for the first iteration it works fine but when it comes to FETCH NEXT CURSOR in the second iteration , programs gets dumping by saying that 'CURSOR already closed'.
    I am not closing the cursor in the program but some how it got closed some where in the standard function module which I used for parallel processing.
    I used WITHHOLD also along with FETCH CURSOR but no use. Please let me know how to avoid the cursor to get close.
    Below is my code
    IF NOT l_tab_product IS INITIAL.
        OPEN CURSOR WITH HOLD lv_cursor FOR
         SELECT contract_int prodint cn_currency mig_grp
              INTO TABLE gt_cont
                FROM bca_contract
                FOR ALL ENTRIES IN l_tab_product
                WHERE prodint = l_tab_product-prodint
                AND   mig_grp IN s_migrp.
        DO.
          FETCH NEXT CURSOR lv_cursor
                            INTO TABLE gt_cont
                                 PACKAGE SIZE lv_size.
          IF sy-subrc <> 0.
            CLOSE CURSOR lv_cursor.
            EXIT.
          ELSE.
    parallel processing logic
    ENDDO.
    ENDIF.

    Using Withhold will not make sure that the cursor will not get closed because of commits.
    SAP Doc says
    If the addition WITH HOLD is specified, the database cursor is not closed by a database commit executed using Native SQL. The addition does not have an influence, however, on implicit database commits or on any rollbacks which always close the database cursor.
    You have to check the part written in your parallel processing logic.
    As Brad said please donot dump your old threads like this.

  • Issue with fetching a record from IHPA table with PARNR value as condition

    Hi All,
    I am trying to fetch a particular record from IHPA table where i am giving the OBJNR number, PARVW and PARNR as customer no. , But I am not getting any record  but if i will give OBJNR and PARVW it will generate a record with having same PARNR value.
    Example :
    case 1st :-
    when i am passing following values in IHPA table,
    OBJNR  = IE000000000010070910
    PRAVW = BP                 
    PARNR  = 620000562   
    it is not generating any record  
    case 2nd:-
    But if i will pass  
    OBJNR  = IE000000000010070910
    PRAVW = BP
    it will generate a record?(one row) which will include PARNR as same 620000562 along with other value.
    Q1 -  Why it's not generating in case 1st,
    Q2 - How I will resolve this issue ? as i have to link some table as EQUI -
    IHPA -
    VCKUN
    VCNUM ?
          I have written a code for this to join :
         SELECT A~EQUNR
           B~PARVW
           C~CCNUM
           D~CCNUM
           FROM EQUI AS A JOIN IHPA AS B ON AOBJNR = BOBJNR
           INNER JOIN VCKUN AS C ON BPARNR = CKUNNR
           INNER JOIN VCNUM AS D ON CCCNUM = DCCNUM
           APPENDING CORRESPONDING FIELDS OF TABLE IT_OBSO
           WHERE A~EQUNR IN S_EQN.
                 AND PARVW  = 'BP'.
          But it is not generating any record but when i am commenting the PARVW i am getting the mixed record of PARVW as (BP,SP,SH)
    Let me know if any more clarification required.
    Highly appreciate your help
    Thanks & Regards
    Shaw

    Hi Santosh,
    Thanks for your quick response.
    But I am Sorry, I already checked with putting Zero before PARNR.
    The issue is still as it is.
    Thanks
    Shaw

  • Issue with fetching data from AFRU

    Hi All,
    We are trying to immitate the standard transaction COOIS but with some extra features to get a report.
    We have a particular select in the custom code which is timing out and taking an unusually long time(infact never finished the select) if run in background.
    Custom Code
        SELECT RUECK
               RMZHL
               LMNGA
               IEDD
               MANUR
               AUFNR
               APLFL FROM AFRU
                     INTO TABLE GT_AFRU
                     FOR ALL ENTRIES IN GT_AFVC
                     WHERE RUECK = GT_AFVC-RUECK
                      AND RMZHL = GT_AFVC-RMZHL
                       AND MANUR = '1'
                       AND APLFL NE ' '.
    Standard Code
      SELECT * FROM afru INTO TABLE afru_tmp
                         FOR ALL ENTRIES IN rueck_tmp
                         WHERE rueck     =  rueck_tmp-rueck
                         AND ( canum     =  canum_0
                         OR    canum     IS NULL ).
    The standard code returns the entries in blink of the eye whereas the custom code runs on for ever. Both the for all entries tables have the same entries and use the same primary key.
    I also tried to fetch data from the table directly using SE16 and I input only 10 confirmations(RUECK-primary key) into the table and I try to execute this in background and it also seems to run for ever. Does anyone have any idea what is going wrong here? Pointers will be appreciated.
    Regards,
    Karthik

    YOu should make a check if the table GT_AFVC has any entries in it or not.
    if not GT_AFVC[] is initial.
    SELECT RUECK
    RMZHL
    LMNGA
    IEDD
    MANUR
    AUFNR
    APLFL FROM AFRU
    INTO TABLE GT_AFRU
    FOR ALL ENTRIES IN GT_AFVC
    WHERE RUECK = GT_AFVC-RUECK
    AND RMZHL = GT_AFVC-RMZHL
    AND MANUR = '1'
    endif.

  • Issue with fetching data based on the given criteria.....

    Dear All,
    I am a bit new to oracle, Please can some help me.
    I need to design a report out of the below data:
    1. bprf_no will be my primary field
    2. report parameters will be the bill_month & no_of_months
    Based on above 2 parameters I need to scan through the data for BILL_MONTH <= '30-Jun-2012' and NO_OF_MONTHS >= 3 the other criteria being the AVG_IND in (1,2).
    In brief the criteria will be to pick all BPRF_NO having AVG_ID in (1, 2) consecutively till a break (AVG_IND not in (1, 2) starting from the given BILL_MONTH and going below this period, that is BILL_MONTH <= '30-Jun-2012'.
    For the below data, if my parameters are: BILL_MONTH <= '30-Jun-2012' and NO_OF_MONTHS >= 3, only the underlined data should be picked (as they fulfill the criteria) and the report output will be like the one posted below the sample data:
    Here the NO_OF_TIMES is the count, that is no of times the BPRF_NO falls into the above mentioned criteria consecutively starting from the provided BILL_MONTH.
    BPRF_NO BILL_MONTH VOID_STATUS AVG_IND
    BP01 30-Jun-12 0 0
    BP02 30-Jun-12 0 0
    BP03 30-Jun-12 0 1
    BP04 30-Jun-12 0 1
    BP05 30-Jun-12 0 1
    BP06 30-Jun-12 0 2
    BP07 30-Jun-12 0 2
    BP08 30-Jun-12 0 2
    BP09 30-Jun-12 0 0
    BP10 30-Jun-12 0 0
    BP10 30-Jun-12 0 0
    BP01 31-May-12 0 0
    BP02 31-May-12 0 0
    BP03 31-May-12 0 1
    BP04 31-May-12 0 1
    BP05 31-May-12 0 1
    BP06 31-May-12 0 2
    BP07 31-May-12 0 2
    BP08 31-May-12 0 2
    BP09 31-May-12 0 0
    BP10 31-May-12 0 0
    BP01 30-Apr-12 0 0
    BP02 30-Apr-12 0 0
    BP03 30-Apr-12 0 0
    BP04 30-Apr-12 0 0
    BP05 30-Apr-12 0 1
    BP06 30-Apr-12 0 2
    BP07 30-Apr-12 0 2
    BP08 30-Apr-12 0 2
    BP09 30-Apr-12 0 0
    BP10 30-Apr-12 0 0
    BP01 31-Mar-12 0 0
    BP02 31-Mar-12 0 0
    BP03 31-Mar-12 0 1
    BP04 31-Mar-12 0 1
    BP05 31-Mar-12 0 1
    BP06 31-Mar-12 0 2
    BP07 31-Mar-12 0 2
    BP08 31-Mar-12 0 2
    BP09 31-Mar-12 0 0
    BP10 31-Mar-12 0 0
    BP01 29-Feb-12 0 0
    BP02 29-Feb-12 0 0
    BP03 29-Feb-12 0 1
    BP04 29-Feb-12 0 1
    BP05 29-Feb-12 0 1
    BP06 29-Feb-12 0 2
    BP07 29-Feb-12 0 2
    BP08 29-Feb-12 0 2
    BP09 29-Feb-12 0 0
    BP10 29-Feb-12 0 0
    BP01 31-Jan-12 0 0
    BP02 31-Jan-12 0 0
    BP03 31-Jan-12 0 0
    BP04 31-Jan-12 0 0
    BP05 31-Jan-12 0 1
    BP06 31-Jan-12 0 2
    BP07 31-Jan-12 0 2
    BP08 31-Jan-12 0 2
    BP09 31-Jan-12 0 0
    BP10 31-Jan-12 0 0
    Below is the correct output that I am supposed to get.
    BPRF_NO BILL_MONTH NO_OF_TIMES
    BP05 30-Jun-2012 6
    BP06 30-Jun-2012 6
    BP07 30-Jun-2012 6
    BP08 30-Jun-2012 6
    My below query is fetching me wrong data:
    Here BP03 & BP04 should not come into the listing itself.
    select bprf_no, last_avg_bill_month, no_of_month
    from
    ( select a.bprf_no, max(a.bill_month) last_avg_bill_month, count(*) no_of_month
    from
    ( select
    bill_month, avg_ind, bprf_no
    from ibsoifc.vw_ibs_bill
    where bill_month <= '30-Jun-2012'
    and void_status = 0
    and avg_ind in (1, 2)
    order by bprf_no desc, bill_month desc ) a, ibsoifc.vw_ibs_bill b
    where a.bprf_no = b.bpref_no
    and a.bill_month = b.bill_month
    group by a.bprf_no
    having count(a.bprf_no) >= '&no_of_month' )
    group by bprf_no,last_avg_bill_month, no_of_month
    BPRF_NO LAST_AVG_BILL_MONTH NO_OF_TIMES
    BP03 30-Jun-2012 4
    BP04 30-Jun-2012 4
    BP05 30-Jun-2012 6
    BP06 30-Jun-2012 6
    BP07 30-Jun-2012 6
    BP08 30-Jun-2012 6

    Based on my understanding..
    select *
    from t
    order by bill_month desc,bprf_no;
    BPRF_NO    BILL_MONTH VOID_STATUS AVG_IND
    BP01       30-JUN-12            0       0
    BP02       30-JUN-12            0       0
    BP03       30-JUN-12            0       1
    BP04       30-JUN-12            0       1
    BP05       30-JUN-12            0       1
    BP06       30-JUN-12            0       2
    BP07       30-JUN-12            0       2
    BP08       30-JUN-12            0       2
    BP09       30-JUN-12            0       0
    BP10       30-JUN-12            0       0
    BP10       30-JUN-12            0       0
    BP01       31-MAY-12            0       0
    BP02       31-MAY-12            0       0
    BP03       31-MAY-12            0       1
    BP04       31-MAY-12            0       1
    BP05       31-MAY-12            0       1
    BP06       31-MAY-12            0       2
    BP07       31-MAY-12            0       2
    BP08       31-MAY-12            0       2
    BP09       31-MAY-12            0       0
    BP10       31-MAY-12            0       0
    BP01       30-APR-12            0       0
    BP02       30-APR-12            0       0
    BP03       30-APR-12            0       0
    BP04       30-APR-12            0       0
    BP05       30-APR-12            0       1
    BP06       30-APR-12            0       2
    BP07       30-APR-12            0       2
    BP08       30-APR-12            0       2
    BP09       30-APR-12            0       0
    BP10       30-APR-12            0       0
    BP01       31-MAR-12            0       0
    BP02       31-MAR-12            0       0
    BP03       31-MAR-12            0       1
    BP04       31-MAR-12            0       1
    BP05       31-MAR-12            0       1
    BP06       31-MAR-12            0       2
    BP07       31-MAR-12            0       2
    BP08       31-MAR-12            0       2
    BP09       31-MAR-12            0       0
    BP10       31-MAR-12            0       0
    BP01       29-FEB-12            0       0
    BP02       29-FEB-12            0       0
    BP03       29-FEB-12            0       1
    BP04       29-FEB-12            0       1
    BP05       29-FEB-12            0       1
    BP06       29-FEB-12            0       2
    BP07       29-FEB-12            0       2
    BP08       29-FEB-12            0       2
    BP09       29-FEB-12            0       0
    BP10       29-FEB-12            0       0
    BP01       31-JAN-12            0       0
    BP02       31-JAN-12            0       0
    BP03       31-JAN-12            0       0
    BP04       31-JAN-12            0       0
    BP05       31-JAN-12            0       1
    BP06       31-JAN-12            0       2
    BP07       31-JAN-12            0       2
    BP08       31-JAN-12            0       2
    BP09       31-JAN-12            0       0
    BP10       31-JAN-12            0       0
    61 rows selected
    with t1 as
      (select BPRF_NO,BILL_MONTH,VOID_STATUS,AVG_IND,sm,
             case when sm >= 3 then
                        nvl(sm - lag(sm) over(partition by bill_month order by bprf_no),sm)
                  else 0 end d
      from(
        select BPRF_NO,BILL_MONTH,VOID_STATUS,AVG_IND,
               sum(decode(avg_ind,1,1,2,1,0)) over(partition by bill_month order by bprf_no) sm
        from t
        where bill_month = to_date('30-Jun-12','dd-Mon-yy')
        order by bill_month desc,bprf_no)
    select t1.bprf_no,count(t.bprf_no)+1 no_of_times -- "The '1' stands for the count in t"
    from t1, t
    where t1.bprf_no = t.bprf_no -- "This can be an outer join based on your requirement and data.."
    and t1.d = 1
    and t.bill_month < to_date('30-Jun-12','dd-Mon-yy')
    group by t1.bprf_no
    order by 1;
    BPRF_NO    NO_OF_TIMES
    BP05                 6
    BP06                 6
    BP07                 6
    BP08                 6

  • Issue with fetching records when SalesForce Date Fields involved

    Using the Events application of Salesforce I enter a record of data.  The record has a Start Date of Monday and an End Date of Friday for a given week.  Crystal will not fetch/display the record in the report.  If I go back and change the Start Date and the end Date to teh same day, the record will print in Crystal.
    Is there some Date flag within Crystal that I need to toggle allowing a record to print based on date ranges?  I don't understand why a record would print when Start and End Date are the same but will not print when different?

    Here is the code....  I have also noticed that there are three fields - Start Date, End Date and Due Date.  Only when all 3 fields are set to the same value within Salesforce will the record print in Crystal.  I have tried removing any reference to the Date fields in the crystal report but its not helping
    www.salesforce.com
    SELECT Name, Id
    FROM   Account
    EXTERNAL JOIN Account.Id={?www.salesforce.com: Event.AccountId}
    www.salesforce.com
    SELECT ActivityDate, CAT_Type__c, Subject, Location, PO_Number__c, CO_Number__c, Is_Closed__c, Description, Submit_For_Invoice__c, Is_Scheduled__c, Status__c, RecurrenceStartDateTime, RecurrenceEndDateOnly, OwnerId, AccountId
    FROM   Event
    WHERE  (CAT_Type__c='Remote Support - Non Revenue' OR CAT_Type__c='Remote Support - Revenue' OR CAT_Type__c='Travel - Non Revenue' OR CAT_Type__c='Travel - Revenue') AND (Status__c='Closed' OR Status__c='Complete - Not Closed' OR Status__c='Open')
    EXTERNAL JOIN Event.AccountId={?www.salesforce.com: Account.Id} AND Event.OwnerId={?www.salesforce.com: User.Id}
    www.salesforce.com
    SELECT LastName, Id
    FROM   User
    EXTERNAL JOIN User.Id={?www.salesforce.com: Event.OwnerId}

  • Does anyone have an issue with the cursor moving itself around?

    My cursor moves itself to a new spot on my text and inserts itself, sometimes highlights, and often deletes. I just updated my 06 MacBook to Mountain Lion, and it's been great EXCEPT for this huge bug. It's infuriating. Has anyone else seen this?

    I guess that's good and bad. Doesn't sound like your battery is defective, but we're no closer to figuring out the problem.
    Do you have any programs that affect the mouse, trackpad, finder?
    Does it happen while booted into Safe Mode?
    How about in another user account? (Guest would be suitable if you don't have another).

  • Hi, I am having issues with my cursor disappearing during typing in app's such as forum chat boxes & facebook chats.

    I look up to find most of what I type is not there, I have to left mouse click to get the cursor back then type it all again. I have switched to IE as a test and so far I do not have the problem. I would prefer to use Firefox but this little glitch is annoying. Can you please assist.

    I look up to find most of what I type is not there, I have to left mouse click to get the cursor back then type it all again. I have switched to IE as a test and so far I do not have the problem. I would prefer to use Firefox but this little glitch is annoying. Can you please assist.

  • Issue with fetching the metadata of Agile tables

    Can some one tell me how to retrieve metadata of all the tables of a particular Agile object and display it into an html page ? (something like how it is displayed in the Agile >Print preview)
    Any help appreciated.
    Thanks

    There is a JavaDoc on SDK. it is located in SDK integration folder in Agile software. you need to access machiend where agile is installed.
    for DB tables stuff, create schema doc using toad by pointing to Agile Schema.
    Swayamsevak

  • I downloaded Yosemite last week, having major issues with typing

    dw yosimite last week and have had major issues with typing, cursor leaving page

    Hi KevinfromGeneva,
    Welcome to the Support Communities!  Are you working with a wireless keyboard or mouse, or are you having issues with a trackpad?  The article below offers general troubleshooting tips for issues with these input devices:
    Troubleshooting wireless mouse and keyboard issues - Apple Support
    Cheers,
    - Judy

  • Replace the following open/fetch/close statements with a cursor FOR loop

    Hi anyone could you please help me,
    I would like to replace the following open/fetch/close statements with a cursor FOR loop.
    Codes are:
    CREATE OR REPLACE PROCEDURE COMOES.orchid_shipment_interface IS
      -- get the com shipment header records
      CURSOR c_com_shphdr ( p_dwn_end_dt DATE ) IS
      SELECT custno client_id
           , plheadno plheadno
           , DECODE(carr_no,'FEDX',lading_no,'UPS',lading_no,carrier_pro_no) tracking_no
           , carr_no||'/'||carr_method carrier_id
           , plantid plant_id
           , carr_no
           , lading_no
           , del_custaddr ship_to_id
           , ol_type cfm_order_type
           , del_custno
           , shipterm    freight_terms
           , del_custattn attn_line
           , custaddr
        FROM com_plhead@com_pricing.world
       WHERE status = '9'
         AND (mod_dat) > p_dwn_end_dt;
      -- get the com shipment address records
      CURSOR c_com_shpadr (p_custaddr VARCHAR2) IS
      SELECT name1 addr_name
           , street1 addr_line1
           , street2 addr_line2
           , city city
           , state state_cd
           , zip zip
           , country country_cd
           , phone work_phone
           , email email1
        FROM com_address@com_pricing.world
       WHERE addr_id = p_custaddr;
      -- get the com shipment detail records
      CURSOR c_com_shpdtl ( p_plheadno NUMBER) IS
      SELECT pll.plheadno pllheadno
           , pll.pllineno ord_line_no
           , pll.ol_no erp_line_no
           , pll.ol_segno
           , pll.fg_id sku
           , pll.qty_shipped ship_qty
           , pll.ordno erp_ord_no
           FROM com_plline@com_pricing.world pll
       WHERE pll.plheadno = p_plheadno
         AND NOT EXISTS (SELECT '1'
                           FROM com_pkg_int_interface@com_pricing.world  cpi
                          WHERE pll.ordno = cpi.ordno
                            AND pll.ol_no = cpi.ol_no);
      -- type declaration
      -- type declaration of com table.
      TYPE t_com_shphdr IS TABLE OF c_com_shphdr%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_orchid_shphdr IS TABLE OF orchid_shipment_hdr_intf%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_com_shpadr IS TABLE OF c_com_shpadr%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_orchid_shpadr IS TABLE OF orchid_shipment_address_intf%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_com_shpdtl IS TABLE OF c_com_shpdtl%ROWTYPE INDEX BY BINARY_INTEGER;
      TYPE t_orchid_shpdtl IS TABLE OF orchid_shipment_dtl_intf%ROWTYPE INDEX BY BINARY_INTEGER;
      lv_company_code       com_customer.business_unit%TYPE;
      lv_erp_ord_no         com_plline.ordno%TYPE;
      lv_actual_ship_date   com_plline.confirm_date%TYPE;
      lv_po_no              com_oline.po_no%TYPE;
      lv_ord_date           com_oline.entrydate%TYPE;
      lv_hdr_batch_ctrl_no  download_batch_info.batch_ctrl_no%TYPE;
      lv_adr_batch_ctrl_no  download_batch_info.batch_ctrl_no%TYPE;
      lv_dtl_batch_ctrl_no  download_batch_info.batch_ctrl_no%TYPE;
      lv_sku_desc           com_salesitem.title%TYPE;
      lv_ord_qty            com_oldelseg.qty%TYPE;
      lr_com_shphdr    t_com_shphdr;
      lr_orchid_shphdr t_orchid_shphdr;
      lr_com_shpadr    t_com_shpadr;
      lr_orchid_shpadr t_orchid_shpadr;
      lr_com_shpdtl    t_com_shpdtl;
      lr_orchid_shpdtl t_orchid_shpdtl;
      -- variable declaration
      ln_shphdr_seq    NUMBER(10):= 0;
      ln_shpadr_seg    NUMBER(10):= 0;
      ln_shpdtl_seq    NUMBER(10):= 0;
      cnt              NUMBER(10):= 0;
      cnt1             NUMBER(10):= 0;
      ld_hdr_dwn_end_dt           download_batch_info.download_end_tstamp%TYPE;
      lc_hdr_dwn_status           download_batch_info.dwn_status%TYPE;
      ld_hdr_download_end_tstamp  DATE;
      ln_hdr_running_seq          NUMBER(10) := 0;
      ld_adr_dwn_end_dt           download_batch_info.download_end_tstamp%TYPE;
      lc_adr_dwn_status           download_batch_info.dwn_status%TYPE;
      ld_adr_download_end_tstamp  DATE;
      ln_adr_running_seg          NUMBER(10) := 0;
      ld_dtl_dwn_end_dt           download_batch_info.download_end_tstamp%TYPE;
      lc_dtl_dwn_status           download_batch_info.dwn_status%TYPE;
      ld_dtl_download_end_tstamp  DATE;
      ln_dtl_running_seq          NUMBER(10) := 0;
    BEGIN
      -- get the batch control number details from batch information table for shipment header
      BEGIN
        SELECT batch_ctrl_no
             , NVL(download_end_tstamp,TO_DATE('01/01/1980','MM/DD/YYYY'))
             , dwn_status
          INTO lv_hdr_batch_ctrl_no
             , ld_hdr_dwn_end_dt
             , lc_hdr_dwn_status
          FROM comoes.download_batch_info
         WHERE download_id = 'ORCHID_SHIPMENT_HDR_INTF';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE (' No Data Found for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN TOO_MANY_ROWS THEN
          DBMS_OUTPUT.PUT_LINE (' Too Many Rows found for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!'||SQLERRM);
          RAISE;
      END;
      -- get the batch control number details from batch information table for shipment address
      BEGIN
        SELECT batch_ctrl_no
             , NVL(download_end_tstamp,TO_DATE('01/01/1980','MM/DD/YYYY'))
             , dwn_status
          INTO lv_adr_batch_ctrl_no
             , ld_adr_dwn_end_dt
             , lc_adr_dwn_status
          FROM comoes.download_batch_info
         WHERE download_id = 'ORCHID_SHIPMENT_ADDRESS_INTF';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE (' No Data Found for ORCHID_SHIPMENT_ADDRESS_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN TOO_MANY_ROWS THEN
          DBMS_OUTPUT.PUT_LINE (' Too Many Rows found for ORCHID_SHIPMENT_ADDRESS_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_ADDRESS_INTF in Download Batch Info table...!!!'||SQLERRM);
          RAISE;
      END;
      -- get the batch control number details from batch information table for shipment details
      BEGIN
        SELECT batch_ctrl_no
             , NVL(download_end_tstamp,TO_DATE('01/01/1980','MM/DD/YYYY'))
             , dwn_status
          INTO lv_dtl_batch_ctrl_no
             , ld_dtl_dwn_end_dt
             , lc_dtl_dwn_status
          FROM download_batch_info
         WHERE download_id = 'ORCHID_SHIPMENT_DTL_INTF';
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE (' No Data Found for ORCHID_SHIPMENT_DTL_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN TOO_MANY_ROWS THEN
          DBMS_OUTPUT.PUT_LINE (' Too Many Rows found for ORCHID_SHIPMENT_DTL_INTF in Download Batch Info table...!!!');
          RAISE;
        WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_DTL_INTF in Download Batch Info table...!!!'||SQLERRM);
          RAISE;
      END;
      -- if previous run is not sucess then do nothing and return.
      OPEN c_com_shphdr ( ld_hdr_dwn_end_dt ) ;
      LOOP
        -- delete the collection for every cycle
        lr_com_shphdr.DELETE;
        lr_orchid_shphdr.DELETE;
        lr_com_shpadr.DELETE;
        lr_orchid_shpadr.DELETE;
        lr_com_shpdtl.DELETE;
        lr_orchid_shpdtl.DELETE;
        -- fetch the order header records to collection
        FETCH c_com_shphdr BULK COLLECT INTO lr_com_shphdr LIMIT 500;
        -- where there is no record in the collection the exit from the loop
        EXIT WHEN lr_com_shphdr.COUNT = 0;
        -- build your logic there to populate the data into order header collection.
          FOR i IN 1..lr_com_shphdr.COUNT
          LOOP
            -- accumulate header running sequence number
            ln_hdr_running_seq := ln_hdr_running_seq + 1;
            ln_shphdr_seq      := ln_hdr_running_seq;
             -- Get the business unit for the customer from com_customer
            BEGIN
              SELECT business_unit
                INTO lv_company_code
                FROM com_customer@com_pricing.world
               WHERE custno = lr_com_shphdr(i).del_custno;
            EXCEPTION
            WHEN OTHERS THEN
              lv_company_code := NULL;
            END;
            -- Get the ordno, confirm_date from COM_PLLINE
            BEGIN
            SELECT ordno
                 , confirm_date
              INTO lv_erp_ord_no
                 , lv_actual_ship_date
              FROM com_plline@com_pricing.world cpl
             WHERE cpl.plheadno = lr_com_shphdr(i).plheadno
               AND ROWNUM = 1;
            EXCEPTION
            WHEN OTHERS THEN
              lv_erp_ord_no       := NULL;
              lv_actual_ship_date := NULL;
            END;
            -- Get the po_no, Entry_date from COM_OLINE
            BEGIN
              SELECT po_no
                   , entrydate
                INTO lv_po_no
                   , lv_ord_date
                FROM com_oline@com_pricing.world col
               WHERE col.ordno = lv_erp_ord_no
                 AND ROWNUM = 1;
            EXCEPTION
            WHEN OTHERS THEN
              lv_po_no    := NULL;
              lv_ord_date := NULL;
            END;
            -- To assign the Bol Number from Lading Number
            IF lr_com_shphdr(i).carr_no NOT IN ('FEDX','UPS') THEN
               lr_orchid_shphdr(i).bol_no     := lr_com_shphdr(i).lading_no;
            ELSE
               lr_orchid_shphdr(i).bol_no     := NULL;
            END IF;
            -- For each order header get the Shipment Delivery Adderss
            OPEN c_com_shpadr ( lr_com_shphdr(i).custaddr);
            FETCH c_com_shpadr BULK COLLECT INTO lr_com_shpadr;
            -- where there is no record in the collection the exit from the loop
            EXIT WHEN lr_com_shpadr.COUNT = 0;
            -- biuld your logic here to populate the del address collection.
              FOR j IN 1..lr_com_shpadr.COUNT
              LOOP
                -- accumulate the loop count into temp variable, so that will through tell each set of order header.
                cnt := cnt + 1;
                -- accumolate the header running sequence number.
                ln_adr_running_seg := ln_adr_running_seg + 1;
                ln_shpadr_seg := ln_adr_running_seg;
                -- move the order address data into collection.
                lr_orchid_shpadr(cnt).client_id       := lr_com_shphdr(i).del_custno;
                lr_orchid_shpadr(cnt).ord_no          := lr_com_shphdr(i).plheadno;
                lr_orchid_shpadr(cnt).tracking_no     := lr_com_shphdr(i).tracking_no;
                lr_orchid_shpadr(cnt).addr_name       := lr_com_shpadr(j).addr_name;
                lr_orchid_shpadr(cnt).attn_line       := lr_com_shphdr(i).attn_line;
                lr_orchid_shpadr(cnt).addr_line1      := lr_com_shpadr(j).addr_line1;
                lr_orchid_shpadr(cnt).addr_line2      := lr_com_shpadr(j).addr_line2;
                lr_orchid_shpadr(cnt).addr_line3      := NULL;
                lr_orchid_shpadr(cnt).addr_line4      := NULL;
                lr_orchid_shpadr(cnt).addr_line5      := NULL;
                lr_orchid_shpadr(cnt).city            := lr_com_shpadr(j).city;
                lr_orchid_shpadr(cnt).state_cd        := lr_com_shpadr(j).state_cd;
                lr_orchid_shpadr(cnt).zip             := lr_com_shpadr(j).zip;
                lr_orchid_shpadr(cnt).zip_ext         := NULL;
                lr_orchid_shpadr(cnt).country_cd      := lr_com_shpadr(j).country_cd;
                lr_orchid_shpadr(cnt).tax_geo_cd      := NULL;
                lr_orchid_shpadr(cnt).work_phone      := lr_com_shpadr(j).work_phone;
                lr_orchid_shpadr(cnt).email1          := lr_com_shpadr(j).email1;
                lr_orchid_shpadr(cnt).cre_dat         := SYSDATE;
                lr_orchid_shpadr(cnt).cre_usr         := USER;
                lr_orchid_shpadr(cnt).batch_ctrl_no   := lv_adr_batch_ctrl_no;
              END LOOP;
            CLOSE c_com_shpadr;
            -- For each order header get the order detail/delivery segment data
            OPEN c_com_shpdtl ( lr_com_shphdr(i).plheadno );
            FETCH c_com_shpdtl BULK COLLECT INTO lr_com_shpdtl;
            -- where there is no record in the collection the exit from the loop
            EXIT WHEN lr_com_shpdtl.COUNT = 0;
            -- build your logic here to populate the order detail collection
              FOR k IN 1..lr_com_shpdtl.COUNT
              LOOP
                -- accumulate the loop count into a temp variable, so that will through till each set of Order Header.
                cnt1 := cnt1 + 1;
                -- accumulate header running sequence number
                ln_dtl_running_seq := ln_dtl_running_seq + 1;
                ln_shpdtl_seq := ln_dtl_running_seq;
                -- Get Quantity for the delvery from delevery segment table.
                BEGIN
                  SELECT NVL(Qty,0)
                    INTO lv_ord_qty
                    FROM com_oldelseg@com_pricing.world cds
                   WHERE cds.ordno = lr_com_shpdtl(k).erp_ord_no
                     AND cds.ol_no = lr_com_shpdtl(k).erp_line_no
                     AND cds.ol_segno = lr_com_shpdtl(k).ol_segno;
                EXCEPTION
                  WHEN OTHERS THEN
                    lv_ord_qty := NULL;
                END;
                -- Get Title for the salesitem from the salesitem table.
                BEGIN
                  SELECT Title
                    INTO lv_sku_desc
                    FROM com_salesitem@com_pricing.world cs
                   WHERE cs.fg_id = lr_com_shpdtl(k).sku;
                EXCEPTION
                  WHEN OTHERS THEN
                    lv_sku_desc := NULL;
                END;
                -- move the Order detail data into collection
                lr_orchid_shpdtl(cnt1).client_id         := lr_com_shphdr(i).client_id;
                lr_orchid_shpdtl(cnt1).ord_no            := lr_com_shphdr(i).plheadno;
                lr_orchid_shpdtl(cnt1).ord_line_no       := lr_com_shpdtl(k).ord_line_no;
                lr_orchid_shpdtl(cnt1).erp_line_no       := lr_com_shpdtl(k).erp_line_no;
                lr_orchid_shpdtl(cnt1).sku               := lr_com_shpdtl(k).sku;
                lr_orchid_shpdtl(cnt1).tracking_no       := lr_com_shphdr(i).tracking_no;
                lr_orchid_shpdtl(cnt1).container_no      := NULL;
                lr_orchid_shpdtl(cnt1).ord_qty           := lv_ord_qty;
                lr_orchid_shpdtl(cnt1).ship_qty          := lr_com_shpdtl(k).ship_qty;
                lr_orchid_shpdtl(cnt1).price_point       := NULL;
                lr_orchid_shpdtl(cnt1).pick_invoice_no   := NULL;
                lr_orchid_shpdtl(cnt1).cancel_qty        := NULL;
                lr_orchid_shpdtl(cnt1).bldg_id           := NULL;                              --lr_com_shpdtl(k).bldg_id;
                lr_orchid_shpdtl(cnt1).sku_company       := NULL;                              --lr_com_shpdtl(k).sku_company;
                lr_orchid_shpdtl(cnt1).sku_desc          := lv_sku_desc;
                lr_orchid_shpdtl(cnt1).icc_cd1           := NULL;                              --lr_com_shpdtl(k).icc_cd1;
                lr_orchid_shpdtl(cnt1).erp_ord_no        := lr_com_shpdtl(k).erp_ord_no;
                lr_orchid_shpdtl(cnt1).cre_dat           := SYSDATE;
                lr_orchid_shpdtl(cnt1).cre_usr           := USER;
                lr_orchid_shpdtl(cnt1).batch_ctrl_no     := lv_dtl_batch_ctrl_no;
              END LOOP;
            CLOSE c_com_shpdtl;
            -- build the logic to populate Order Header
            lr_orchid_shphdr(i).client_id              := lr_com_shphdr(i).client_id;
            lr_orchid_shphdr(i).ord_no                 := lr_com_shphdr(i).plheadno;
            lr_orchid_shphdr(i).tracking_no            := lr_com_shphdr(i).tracking_no;
            lr_orchid_shphdr(i).container_no           := NULL;                            -- container number is not maintained in COM
            lr_orchid_shphdr(i).carrier_id             := lr_com_shphdr(i).carrier_id;
            lr_orchid_shphdr(i).plant_id               := lr_com_shphdr(i).plant_id;
            lr_orchid_shphdr(i).erp_ord_no             := lv_erp_ord_no;
            lr_orchid_shphdr(i).erp_ord_no2            := NULL;
            lr_orchid_shphdr(i).po_no                  := lv_po_no;
            lr_orchid_shphdr(i).ship_to_id             := lr_com_shphdr(i).ship_to_id;
            lr_orchid_shphdr(i).ship_to_addr_id        := lr_com_shphdr(i).custaddr;
            lr_orchid_shphdr(i).scac                   := NULL;                             --lr_com_shphdr(i).scac;
            lr_orchid_shphdr(i).actual_ship_date       := lv_actual_ship_date;
            lr_orchid_shphdr(i).cfm_order_type         := lr_com_shphdr(i).cfm_order_type;
            lr_orchid_shphdr(i).company_code           := lv_company_code;
            lr_orchid_shphdr(i).no_of_order_lines      := NULL;                             --lr_com_shphdr(i).no_of_order_lines;
            lr_orchid_shphdr(i).pick_invoice_no        := NULL;
            lr_orchid_shphdr(i).ord_date               := lv_ord_date;
            lr_orchid_shphdr(i).orig_tender_date       := NULL;
            lr_orchid_shphdr(i).orig_delv_date         := NULL;
            lr_orchid_shphdr(i).delivery_flag          := NULL;
            lr_orchid_shphdr(i).delv_date_from         := NULL;
            lr_orchid_shphdr(i).delv_date_to           := NULL;
            lr_orchid_shphdr(i).orig_carr_cd           := NULL;
            lr_orchid_shphdr(i).routing_comment        := NULL;
            lr_orchid_shphdr(i).segment_type           := NULL;
            lr_orchid_shphdr(i).back_order_flag        := NULL;
            lr_orchid_shphdr(i).addr_override_flag     := NULL;
            lr_orchid_shphdr(i).fmx_assigned_carr      := NULL;
            lr_orchid_shphdr(i).fmx_assigned_ship_date := NULL;
            lr_orchid_shphdr(i).fmx_assigned_delv_date := NULL;
            lr_orchid_shphdr(i).freight_terms          := lr_com_shphdr(i).freight_terms;
            lr_orchid_shphdr(i).fmx_load_id            := NULL;
            lr_orchid_shphdr(i).asn_type               := NULL;
            lr_orchid_shphdr(i).icc_cd1                := NULL;                             --lr_com_shphdr(i).icc_cd1;
            lr_orchid_shphdr(i).trans_type             := NULL;
            lr_orchid_shphdr(i).ref_no1                := NULL;
            lr_orchid_shphdr(i).ref_no2                := NULL;
            lr_orchid_shphdr(i).ref_no3                := NULL;
            lr_orchid_shphdr(i).ref_no4                := NULL;
            lr_orchid_shphdr(i).cre_dat                := SYSDATE;
            lr_orchid_shphdr(i).cre_usr                := USER;
            lr_orchid_shphdr(i).batch_ctrl_no          := lv_hdr_batch_ctrl_no;
            -- logic to get total boxes and weight.
            BEGIN
              SELECT SUM(no_cartons), SUM(weight)
                INTO lr_orchid_shphdr(i).total_boxes
                   , lr_orchid_shphdr(i).weight
                FROM com_plline@com_pricing.world pll
               WHERE pll.plheadno = lr_com_shphdr(i).plheadno;
            EXCEPTION
             WHEN OTHERS THEN
                lr_orchid_shphdr(i).total_boxes := NULL;
                lr_orchid_shphdr(i).weight      := NULL;
            END;
          END LOOP;
        -- initialize the variables for next loop cycle.
        cnt := 0;
        cnt1 := 0;
        -- populate the shipment header interface table.
        FOR x IN 1..lr_orchid_shphdr.COUNT
        LOOP
          ld_hdr_download_end_tstamp := lr_orchid_shphdr(x).cre_dat;
          INSERT INTO orchid_shipment_hdr_intf
                    (record_qualifier
                    ,client_id
                    ,ord_no
                    ,tracking_no
                    ,container_no
                    ,bol_no
                    ,carrier_id
                    ,plant_id
                    ,erp_ord_no
                    ,erp_ord_no2
                    ,po_no
                    ,ship_to_id
                    ,ship_to_addr_id
                    ,scac
                    ,actual_ship_date
                    ,cfm_order_type
                    ,company_code
                    ,no_of_order_lines
                    ,pick_invoice_no
                    ,total_boxes
                    ,weight
                    ,ord_date
                    ,orig_tender_date
                    ,orig_delv_date
                    ,delivery_flag
                    ,delv_date_from
                    ,delv_date_to
                    ,orig_carr_cd
                    ,routing_comment
                    ,segment_type
                    ,back_order_flag
                    ,addr_override_flag
                    ,fmx_assigned_carr
                    ,fmx_assigned_ship_date
                    ,fmx_assigned_delv_date
                    ,freight_terms
                    ,fmx_load_id
                    ,asn_type
                    ,upl_status
                    ,icc_cd1
                    ,trans_type
                    ,ref_no1
                    ,ref_no2
                    ,ref_no3
                    ,ref_no4
                    ,cre_dat
                    ,cre_usr
                    ,batch_ctrl_no)
            VALUES
                    ( 10
                    ,lr_orchid_shphdr(x).client_id
                    ,lr_orchid_shphdr(x).ord_no
                    ,lr_orchid_shphdr(x).tracking_no
                    ,lr_orchid_shphdr(x).container_no
                    ,lr_orchid_shphdr(x).bol_no
                    ,lr_orchid_shphdr(x).carrier_id
                    ,lr_orchid_shphdr(x).plant_id
                    ,lr_orchid_shphdr(x).erp_ord_no
                    ,lr_orchid_shphdr(x).erp_ord_no2
                    ,lr_orchid_shphdr(x).po_no
                    ,lr_orchid_shphdr(x).ship_to_id
                    ,lr_orchid_shphdr(x).ship_to_addr_id
                    ,lr_orchid_shphdr(x).scac
                    ,lr_orchid_shphdr(x).actual_ship_date
                    ,lr_orchid_shphdr(x).cfm_order_type
                    ,lr_orchid_shphdr(x).company_code
                    ,lr_orchid_shphdr(x).no_of_order_lines
                    ,lr_orchid_shphdr(x).pick_invoice_no
                    ,lr_orchid_shphdr(x).total_boxes
                    ,lr_orchid_shphdr(x).weight
                    ,lr_orchid_shphdr(x).ord_date
                    ,lr_orchid_shphdr(x).orig_tender_date
                    ,lr_orchid_shphdr(x).orig_delv_date
                    ,lr_orchid_shphdr(x).delivery_flag
                    ,lr_orchid_shphdr(x).delv_date_from
                    ,lr_orchid_shphdr(x).delv_date_to
                    ,lr_orchid_shphdr(x).orig_carr_cd
                    ,lr_orchid_shphdr(x).routing_comment
                    ,lr_orchid_shphdr(x).segment_type
                    ,lr_orchid_shphdr(x).back_order_flag
                    ,lr_orchid_shphdr(x).addr_override_flag
                    ,lr_orchid_shphdr(x).fmx_assigned_carr
                    ,lr_orchid_shphdr(x).fmx_assigned_ship_date
                    ,lr_orchid_shphdr(x).fmx_assigned_delv_date
                    ,lr_orchid_shphdr(x).freight_terms
                    ,lr_orchid_shphdr(x).fmx_load_id
                    ,lr_orchid_shphdr(x).asn_type
                    ,00
                    ,lr_orchid_shphdr(x).icc_cd1
                    ,lr_orchid_shphdr(x).trans_type
                    ,lr_orchid_shphdr(x).ref_no1
                    ,lr_orchid_shphdr(x).ref_no2
                    ,lr_orchid_shphdr(x).ref_no3
                    ,lr_orchid_shphdr(x).ref_no4
                    ,lr_orchid_shphdr(x).cre_dat
                    ,lr_orchid_shphdr(x).cre_usr
                    ,lr_orchid_shphdr(x).batch_ctrl_no);
        END LOOP;
        -- populate the shipment address interface table.
        FOR y IN 1..lr_orchid_shpadr.COUNT
        LOOP
          ld_adr_download_end_tstamp := lr_orchid_shpadr(y).cre_dat;
          INSERT INTO orchid_shipment_address_intf
                      ( record_qualifier
                      , client_id
                      , ord_no
                      , tracking_no
                      , addr_name
                      , attn_line
                      , addr_line1
                      , addr_line2
                      , addr_line3
                      , addr_line4
                      , addr_line5
                      , city
                      , state_cd
                      , zip
                      , zip_ext
                      , country_cd
                      , tax_geo_cd
                      , work_phone
                      , email1
                      , cre_dat
                      , cre_usr
                      , batch_ctrl_no)
               VALUES ( 14
                      , lr_orchid_shpadr(y).client_id
                      , lr_orchid_shpadr(y).ord_no
                      , lr_orchid_shpadr(y).tracking_no
                      , lr_orchid_shpadr(y).addr_name
                      , lr_orchid_shpadr(y).attn_line
                      , lr_orchid_shpadr(y).addr_line1
                      , lr_orchid_shpadr(y).addr_line2
                      , lr_orchid_shpadr(y).addr_line3
                      , lr_orchid_shpadr(y).addr_line4
                      , lr_orchid_shpadr(y).addr_line5
                      , lr_orchid_shpadr(y).city
                      , lr_orchid_shpadr(y).state_cd
                      , lr_orchid_shpadr(y).zip
                      , lr_orchid_shpadr(y).zip_ext
                      , lr_orchid_shpadr(y).country_cd
                      , lr_orchid_shpadr(y).tax_geo_cd
                      , lr_orchid_shpadr(y).work_phone
                      , lr_orchid_shpadr(y).email1
                      , lr_orchid_shpadr(y).cre_dat
                      , lr_orchid_shpadr(y).cre_usr
                      , lr_orchid_shpadr(y).batch_ctrl_no);
        END LOOP;
        -- populate the shipment detail interface table.
        FOR z IN 1..lr_orchid_shpdtl.COUNT
        LOOP
          ld_dtl_download_end_tstamp := lr_orchid_shpdtl(z).cre_dat;
          INSERT INTO orchid_shipment_dtl_intf
                      ( record_qualifier
                      , client_id
                      , ord_no
                      , ord_line_no
                      , erp_line_no
                      , sku
                      , tracking_no
                      , container_no
                      , ord_qty
                      , ship_qty
                      , price_point
                      , pick_invoice_no
                      , cancel_qty
                      , bldg_id
                      , sku_company
                      , sku_desc
                      , icc_cd1
                      , erp_ord_no
                      , cre_dat
                      , cre_usr
                      , batch_ctrl_no)
               VALUES ( 20
                      , lr_orchid_shpdtl(z).client_id
                      , lr_orchid_shpdtl(z).ord_no
                      , lr_orchid_shpdtl(z).ord_line_no
                      , lr_orchid_shpdtl(z).erp_line_no
                      , lr_orchid_shpdtl(z).sku
                      , lr_orchid_shpdtl(z).tracking_no
                      , lr_orchid_shpdtl(z).container_no
                      , lr_orchid_shpdtl(z).ord_qty
                      , lr_orchid_shpdtl(z).ship_qty
                      , lr_orchid_shpdtl(z).price_point
                      , lr_orchid_shpdtl(z).pick_invoice_no
                      , lr_orchid_shpdtl(z).cancel_qty
                      , lr_orchid_shpdtl(z).bldg_id
                      , lr_orchid_shpdtl(z).sku_company
                      , lr_orchid_shpdtl(z).sku_desc
                      , lr_orchid_shpdtl(z).icc_cd1
                      , lr_orchid_shpdtl(z).erp_ord_no
                      , lr_orchid_shpdtl(z).cre_dat
                      , lr_orchid_shpdtl(z).cre_usr
                      , lr_orchid_shpdtl(z).batch_ctrl_no);
        END LOOP;
        COMMIT;
      END LOOP;
      CLOSE c_com_shphdr;
      -- set the status to success
      UPDATE comoes.download_batch_info
         SET batch_ctrl_no = orchid_plhead_btch_ctrl_seq.NEXTVAL
           , dwn_status = '90'
           , download_end_tstamp = NVL(ld_hdr_download_end_tstamp,SYSDATE)
       WHERE download_id = 'ORCHID_SHIPMENT_HDR_INTF'
         AND batch_ctrl_no = lv_hdr_batch_ctrl_no;
      UPDATE comoes.download_batch_info
         SET batch_ctrl_no = orchid_address_btch_ctrl_seq.NEXTVAL
           , dwn_status = '90'
           , download_end_tstamp = NVL(ld_hdr_download_end_tstamp,SYSDATE)
       WHERE download_id = 'ORCHID_SHIPMENT_ADDRESS_INTF'
         AND batch_ctrl_no = lv_adr_batch_ctrl_no;
      UPDATE comoes.download_batch_info
         SET batch_ctrl_no = orchid_plline_btch_ctrl_seq.NEXTVAL
           , dwn_status = '90'
           , download_end_tstamp = NVL(ld_dtl_download_end_tstamp,SYSDATE)
       WHERE download_id = 'ORCHID_SHIPMENT_DTL_INTF'
         AND batch_ctrl_no = lv_dtl_batch_ctrl_no;
      -- Update the download status to success in the interface table.
      -- Shipment Header
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
        -- load is not sucess then set the status to fail
        UPDATE comoes.download_batch_info
           SET dwn_status = '99'
         WHERE download_id = 'ORCHID_SHIPMENT_HDR_INTF'
           AND batch_ctrl_no = lv_hdr_batch_ctrl_no;
        UPDATE comoes.download_batch_info
           SET dwn_status = '99'
         WHERE download_id = 'ORCHID_SHIPMENT_ADDRESS_INTF'
           AND batch_ctrl_no = lv_adr_batch_ctrl_no;
        UPDATE comoes.download_batch_info
           SET dwn_status = '99'
         WHERE download_id = 'ORCHID_SHIPMENT_DTL_INTF'
           AND batch_ctrl_no = lv_dtl_batch_ctrl_no;
        COMMIT;
        DBMS_OUTPUT.PUT_LINE('Following error occured while executing ORCHID_SHIPMENT_INTF procedure...!!!'||SQLERRM);
        RAISE;
    END orchid_shipment_interface;Edited by: BluShadow on 03-Aug-2011 13:28
    added {noformat}{noformat} tags. Please read {message:id=9360002} to learn to do this yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &nb

    Please read the Forum FAQ on how to ask a question, particularly how to format code
    SQL and PL/SQL FAQ
    SQL and PL/SQL FAQ
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE (' Following error occured while getting batch control number for ORCHID_SHIPMENT_HDR_INTF in Download Batch Info table...!!!'||SQLERRM);
    RAISE;http://tkyte.blogspot.com/2008/01/why-do-people-do-this.html

  • Cursor Issues with Snow Leopard

    I am having two cursor-related issues with my mid-2010 MBP, running 10.6.7.  Both problems are intermittent and occur with either the built-in trackpad or the external Magic Trackpad.
    Problem #1:  Cursor movement is normal, however if I attempt to click on a window to bring it to the front, or click on the red button to close a window, or click on a menu item, nothing happens.  Short-cut keys work normally.  Application Switcher works normally.  Thus far, my only solution is to Shut Down the computer and then re-Start it.
    Problem #2:  After a short absence from the computer, I could not find the cursor.  Using the Control 2-finger Zoom, I determined that the cursor was at the upper-right corner of the MBP screen (I do have a second monitor.)  Realizing where the cursor was, I tried to move it.  The cursor would only move away from the corner by less than an inch and then would snap back into the corner.  I performed a Shut Down (could not get to Restart) and Start, which resolved the problem.
    Any thoughts or suggestions would be appreciated.
    Thanks,

    Another update and an easier work-a-round.
    Both problems appear to be "solved" by unplugging the USB cable to my Apple keyboard and mouse.  At that point, I do have control from the MBP trackpad.  If I re-plug in the USB cable, things go back to normal.
    My configuration is:  an external keyboard and mouse (not normally used) connected to the MBP by USB cable (this is the cable that I have to disconnect); and a Magic Trackpad connected by Bluetooth.
    The work-a-round of disconnecting the USB cable is simple enough, but I am still interested if anyone has thoughts on what might be causing the issue in the first place.
    Thanks again for any suggestions.

  • EJB Issue with return empty children in join fetch query

    I'm a newbie and still trying to learn all of the facets of EJB 3.0 (and other backend capabilities) however could not find this issue anywhere resolved.
    I have a recursive table which has a 0,1-n relationship with itself. In this case, I want to query for all objects and fetch the resulting children.
    To do this I have written the following query:
    select o from Node o inner join fetch o.childrenNodeList order by o.nodeorder
    If my database has the following entries:
    Parent
    Child
    Grandchild
    The above query will get all 3 and allow me to access the list of children through getChildrenNodeList, however, for Grandchild this returns "An attempt was made to traverse a relationship using indirection that had a null Session...." for Parent and Child however it works like it should and gets the fetched rows.
    Is there a way for me to either:
    1. Modify the query so that the getChildrenNodeList will return a 0 sized array (so I can test for no children)
    2. Modify the getter such that I can check that the parent really has no children and not some issue with the query
    Thanks for any help,
    Kris

    fixed

  • Issue with cursor(200) in an IE Shockwave movie?

    Has anyone else encountered or fixed this issue before?
    I have my cursor hidden with cursor(200) and am using a
    custom piece of art to follow the mouseLoc in its place. This workd
    fine in Firefox and the executable version of the movie, however in
    IE the -1 cursor will blink in over the piece of art on mouseDown.
    When the cursor's position is updated or on mouseUp the cursor
    resets to 200 and all is good again.
    I've tested placing:
    on mouseEnter me
    sprite(me.spriteNum).cursor = 200
    end mouseEnter
    in the behaviors of my sprites to no avail.
    I've gone back to some older movies created at my company
    using the same code I am using and now they have this issue too,
    when they did not before. Is this a known issue with the Shockwave
    player? or IE? (I happened in IE6 and IE7)

    Mr. Phipps wrote:
    > Unfortunately putting sprite(me.spriteNum).cursor = 200
    doesn't seem
    > to be working on beginSprite either.
    >
    > I am not entirely sure this is a Director/Lingo problem
    and not a
    > Shockwave/IE problem as movies that once used custom art
    for cursors
    > we have previously developed are now exhibiting this bug
    when they
    > did not before. I suppose the only way to test this
    theory is to have
    > an older copy of the SW plugin to install.
    URL of a sample for others to test?
    Andrew

  • Issue with VC/2 - not fetching the invoice details

    Hi All,
    We have an issue with TCode VC/2 in ECC 6. This is not fetching( not showing) the Invoice documents under the header "Last SD Documents".
    It is fetching the sales documents like orders, credit memo/debit memo requests but not the invoice documents.
    PLease help on this.
    Thanks in advance.
    Edited by: Harini Kesani on Jan 12, 2010 8:25 PM

    Is it possible that 'last SD document' means 'last sales document', not 'last billing document'? Unfortunately, I'm unable to confirm - we don't use this transaction. You can also check what tables are used in this transaction (get help from an ABAPer or Basis) and then check if there is correct data in those tables. It might be using info structures or index tables, which may need to be populated first.

Maybe you are looking for