Updating table contents more efficiently

Dear forumers,
I have a situation as elaborated below. Is there a more efficient way in updating table contents (itab D) more efficiently?
loop at itab A.
  execute FM using fields from itab A.
  FM returns itab B.
  loop at itab B.
    populate itab C containing fields from itabs A and B.
  endloop.
endloop.
copy contents from itab D to itab D_temp.   " ***1
clear itab D.
loop at itab C.
populate itab D containing fields from itabs C and D_temp.   " ***2
endloop.
Reason this codeline (***2) is implemented:
The key fields in the initial itab D ***1 is different than the key fields in the end result of itab D ***2.
***1
Key fields: AUFNR, OBKNR, WERKS, EQUNR, SERNR, MATNR
***2
Key fields: DOCUMENTTYPE, DOCUMENTNUMBER, DOCUMENTVERSION, DOCUMENTPART, EQUNR, SERNR, MATNR
Structure in itab C (key fields in ***2):
  equnr           TYPE viaufkst-equnr
  sernr           TYPE objk-sernr
  matnr           TYPE objk-matnr
  documenttype    TYPE zzdoc_data-documenttype
  documentnumber  TYPE zzdoc_data-documentnumber
  documentversion TYPE zzdoc_data-documentversion
  documentpart    TYPE zzdoc_data-documentpart
  description     TYPE zzdoc_data-description
Structure in itab D:
  aufnr           TYPE viaufkst-aufnr
  equnr           TYPE viaufkst-equnr
  obknr           TYPE viaufkst-obknr
  qmnum           TYPE viaufkst-qmnum
  auart           TYPE viaufkst-auart
  werks           TYPE viaufkst-werks
  sernr           TYPE objk-sernr
  matnr           TYPE objk-matnr
  documenttype    TYPE zzdoc_data-documenttype
  documentnumber  TYPE zzdoc_data-documentnumber
  documentversion TYPE zzdoc_data-documentversion
  documentpart    TYPE zzdoc_data-documentpart
  description     TYPE zzdoc_data-description
Many thanks for any inputs here at all.

TRY THIS
CLEAR li_ord_sln_tmp.
  li_ord_sln_tmp = i_ord_sln.
  SORT li_ord_sln_tmp BY equnr sernr matnr.
  DELETE ADJACENT DUPLICATES FROM li_ord_sln_tmp
    COMPARING equnr sernr matnr.
  CLEAR i_ord_sln.
  IF ( li_ord_sln_tmp[] IS NOT INITIAL AND
       i_docs[] IS NOT INITIAL ).
    SORT i_docs[] BY equnr sernr matnr.
  ENDIF.
LOOP AT i_outgoing into w_outgoing.
    CALL FUNCTION 'ZZ_GET_ACTIVE_DMS'
      EXPORTING
        matnr      = w_outgoing-matnr
        werks      = w_outgoing-werks
        sernr      = w_outgoing-sernr
      TABLES
        i_doc_list = li_doclist
      EXCEPTIONS
        OTHERS     = 1.
    IF sy-subrc = 0.
      LOOP AT li_doclist INTO lw_doclist.
      CLEAR .
      MOVE-CORRESPONDING w_outgoing TO w_ord_sln.
      READ TABLE li_ord_sln_tmp
        INTO lw_ord_sln_tmp
        WITH KEY equnr = w_docs-equnr
                 sernr = w_docs-sernr
                 matnr = w_docs-matnr
        BINARY SEARCH.
      IF sy-subrc = 0.
        w_ord_sln-werks = w_docs-werks.
        w_ord_sln-aufnr = lw_ord_sln_tmp-aufnr.
        w_ord_sln-obknr = lw_ord_sln_tmp-obknr.
        w_ord_sln-qmnum = lw_ord_sln_tmp-qmnum.
        w_ord_sln-auart = lw_ord_sln_tmp-auart.
        APPEND w_ord_sln TO i_ord_sln.     " (i.e. this is itab D)
      ENDIF.  
    ENDIF.
  ENDLOOP.
Regards
Sajid
Edited by: shaik sajid on Jul 20, 2009 8:52 AM

Similar Messages

  • Updating table with more than 50 million records

    Hi Team,
    Updating three columns in a table which has 60 millions of records is taking a lot of time. How to improve the performance of the query. The table has to be updated based on the values from different database tables.
    Thanks,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Split them into small batches
    when you are using multiple tables, have them with JOINs
    have the corresponding indexes for joining columns
    disable triggers if any (if possible and doesnt affect your logic - wud be least favourable step ..)
    also these shud help:
    http://blogs.msdn.com/b/repltalk/archive/2011/10/10/lessons-learned-updating-100-millions-rows.aspx
    http://www.sqlservergeeks.com/blogs/AhmadOsama/personal/450/sql-server-optimizing-update-queries-for-large-data-volumes
    http://stackoverflow.com/questions/7344984/update-large-number-of-rows-sql-server-2005
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • How to update a table of contents when the feature "update table of contents" is unavailable?

    Hello folks,
    I've been struggling all morning with this issue and am completely desperate.
    First, some info:
    - I am making a spanish versions of an english documents: everything in the original doc was then edited, including TOCs. What I got at first, was a first spanish document already filled with spanish content.
    - I was not the primary creative of the document I'm workin on and am unable to get in touch with whoever that can be.
    - My document is a 200 pages text only document, with 12 chapters and, at the beginning of each chapter, a specific TOC for that very chapter.
    - Inside each chapter, there are only Sections and Subsections, no other style. Those are the two levels in the TOCs.
    - There is also a General TOC at the beginning of the document: that one only shows the Chapter names and the page number where to locate them.
    My problem:
    - Somewhere along the way, from one doc to another, the TOCs stopped to update the page numbers automatically.
    - Now I have sections and subsections that are shown in one page (for instance 204) but they actually are on page 135.
    - When I try to update the TOCs, I stand on the TOC itself as I was told in many tutorials, but the "update table of contents" feature is unavailable, even in the main TOC at the very beginning of the doc.
    It is like if I wasn't standing in the actual TOC, but there is no actual TOC anywhere that I could refer to.
    What can I do? I am changing the wrong page numbers manually but, of course, that is not ideal... and it may become more and more tricky while I keep producing new documents each based on the previous one.
    Any help will be much appreciated.
    Warm regard from sunny Paris, France!
    Sasha

    You've just confused me.
    My understanding of how this is set up is that either:
    This is a book, and there is a master TOC that includes all book documents and a document-specific TOC in each component file, or
    This is a single file and there is one master TOC that includes all sections and a section-specific TOC that includes only the individual section.
    In the first case, I think you would want two TOC styles set up, one that includes the chapter heads (if I understood how you said this worked) for the for the master, and you would include all docs in the book when you generate it, and a second style for the individual chapters, with the subheadings you want to include.
    In the second case, it would be similar, but instead of only one style to cover the section TOCS, I think you would need to create a unique set of pargraph styles for the headings in each section (they can all be the same format, based one section, just with unique names), and then make a TOC style for each section that includes only the styles from that section.
    OK,  wait a sec. I just reread what you said: "Another thing: when the numbers are "linked" and updating well, they  display indide a little box. Not a text box, but a kind of little frame  around the numbers. That frame makes it imposible to delete just one  number: when the TOC says that Section 6.1 is in page 135, for example,  you cannot delete just the 5, it deletes, not just the 3 numbers, but  also the doted tab."
    I think these are NOT normal TOCs created by using Layout > TOC (but you could replace them with ones that are, if you set up your styles properly and the text you want to include is appearing on the pages). Those little boxes you mention sound like cross-references, which should update automatically without any intervention at all. Unfortunately, cross-refs can be flakey, especially if they point to another document. I'd open the cross-refs panel and see if you need to recreate a bunch of links.

  • Update a table content in database MS access

    Hi
    In my application i am using Database toolkit to write a table in to MS access.
    i am able to write a table in to database but i am facing problem in editing a perticular cell in a table which is there in data base, how this can be achieved?
    When i use insert data vi, a row of data is being inserted. but in my application i need to keep updating the data in the same field.
    Ex: If i have writen a data in the 1st row i should keep updating the values of the 1st row basically i need to edit table contents.
    regards
    anil 

    Anil
    You can DB Tools Execute Query to run an UPDATE query. Take this example where I use the example labview.mdb database in ...\examples\database directory. This VI allows the user to UPDATE the PhoneNumber field for record with CustomerID=23311 which is the first record.
    Hope this helps
    David
    Message Edited by David Crawford on 10-07-2006 09:37 AM
    Attachments:
    Example to Update PhoneNumber Labview MDB (8.0).vi ‏16 KB
    Update Phone Number.jpg ‏17 KB

  • Update table commands it is taking more than 40

    When I am firing an update table commands it is taking more than 40 seconds for it.
    In the explain plan physical reads is around 250000
    Thanks,
    Mohammed

    If you update billion rows, it can be appear as fast. If you update 1 row, it can be appear like slow.
    Without seeing the explain plan... and the query neither... it's difficult to put valuable advice.
    Nicolas.

  • 3 Table Joins -- Need a more efficient Query

    I need a 3 table join but need to do it more efficiently than I am currently doing. The query is taking too long to execute (in excess of 20 mins. These are huge tables with 10 mil + records). Here is what the query looks like right now. I need 100 distinct acctnum from the below query with all the conditions as requirements.
    THANKS IN ADVANCE FOR HELP!!!
    SELECT /*+ parallel  */
      FROM (SELECT  /*+ parallel  */  DISTINCT (a.acctnum),
                                  a.acctnum_status,
                                  a.sys_creation_date,
                                  a.sys_update_date,
                                  c.comp_id,
                                  c.comp_lbl_type,
                                  a.account_sub_type
                  FROM   account a
                         LEFT JOIN
                            company c
                         ON a.comp_id = c.comp_id AND c.comp_lbl_type = 'IND',
                         subaccount s
                 WHERE       a.account_type = 'I'
                         AND a.account_status IN ('O', 'S')
                        and s.subaccount_status in ('A','S')
                         AND a.account_sub_type NOT IN ('G', 'V')
                         AND a.SYS_update_DATE <= SYSDATE - 4 / 24)
    where   ROWNUM <= 100 ;

    Hi,
    Whenever you have a question, post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data.  Explain how you get those results from that data.
    Simplify the problem, if possible.  If you need 100 distinct rows, post a problem where you only need, say, 3 distinct rows.  Just explain that you really need 100, and you'll get a solution that works for either 3 or 100.
    Always say which version of Oracle you're using (e.g. 11.2.0.3.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002
    For tuning problems, also see https://forums.oracle.com/message/9362003
    Are you sure the query you posted is even doing what you want?  You're cross-joining s to the other tables, producing all possible combinations of rows, and then picking 100 of those in no particular order (not even random order).  That's not necessarily wrong, but it certainly is suspicious.
    If you're only interested in 100 rows, there's probably some way to write the query so that it picks 100 rows from the big tables first. 

  • Updating JTable Contents

    I'm having trouble refreshing a JTable after changing it's 2D Object array data. Perhaps this is a stupid question, but any advice would be appreciated.
    Basically I've been building from the SimpleTableDemo.java file in the "How to Use Tables" tutorial. I set Object[][] data to a 2D Object array that is modified by other parts of my program.
    I added the public void tableChanged(TableModelEvent e) function to detect data changes, displaying a simple System.out, but it never seems to get called.
    Is there any way that the JTable can observe changes in the Object[][] data array and update it's self accordingly? I'm never sure if rows are being added or removed.
    I hope that made sense, and thank-you in advance to anyone who replies.
    -Arthur

    Couple of things...
    Whenever you change the contents of your TableModel you need to fire the appropriate event to get the JTable to update the viewed rows... in your case it sounds like you would have to call the "fireTableDataChanged()" method defined by AbstractTableModel so that your contents will be viewed.
    Also... it is rare that you really need to update the entire contents of your table model, most the time it is more efficient to just update the cell or row your need and call the appropriate "fire..." method to update
    Hope this helps
    Josh Castagno
    http://www.jdc-software.com

  • Can not insert or update [TABLE] from internal table in method

    I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
    "An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
    After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
    This is error code.
      METHOD set_data_to_table.
        REFRESH gi_data.
        CLEAR gi_data.
        IF gi_file[] IS NOT INITIAL.
    * Set data for modify table
          LOOP AT gi_file INTO gw_file.
            MOVE-CORRESPONDING gw_file TO gw_data.
            me->conversion_input( EXPORTING im_vendor = gw_data-vendor
                                  CHANGING  ch_vendor = gw_data-vendor ).
            APPEND gw_data TO gi_data.
          ENDLOOP.
          INSERT [TABLE] FROM TABLE gi_data.
    *      LOOP AT gi_data INTO gw_data.
    *        INSERT INTO  [TABLE] VALUES gw_data.
    *        IF sy-subrc = 0.
    *          COMMIT WORK.
    *        ELSE.
    *          ROLLBACK WORK.
    *        ENDIF.
    *      ENDLOOP.
        ELSE.
          MESSAGE 'No data found' TYPE 'I'.
        ENDIF.
      ENDMETHOD.                    "set_data_to_table

    Hi Matthew,
    I think there is no difference in database insert between OO and non-OO.
    The correct syntax according to ECC600 online documentation is
    [Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
    To insert several lines into a database table, use the following:
    INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
    This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
    Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
    I think the syntax
    INSERT my_dbtable FROM TABLE gi_data.
    should work, your suggestion may lead to syntax error.
    Regards,
    Clemens

  • Table with more than 35 columns

    Hello All.
    How can one work with a table with more than 35 columns
    on JDev 9.0.3.3?
    My other question is related to this.
    Setting Entities's Beans properties from a Session Bean
    bought up the error, but when setting from inside the EJB,
    the bug stays clear.
    Is this right?
    Thank you

    Thank you all for reply.
    Here's my problem:
    I have an AS400/DB2 Database, a huge and an old one.
    There is many COBOL Programs used to communicate with this DB.
    My project is to transfer the database with the same structure and the same contents to a Linux/ORACLE System.
    I will not remake the COBOL Programs. I will use the existing one on the Linux System.
    So the tables of the new DB should be the same as the old one.
    That’s why I can not make a relational DB. I have to make an exact migration.
    Unfortunately I have some tables with more than 5000 COLUMNS.
    Now my question is:
    can I modify the parameters of the ORACE DB to make it accept Tables and Views with more than 1000 columns, If not, is it possible to make a PL/SQL Function that simulate a table, this function will insert/update/select data from many other small tables (<1000 columns). I want to say a method that make the ORACLE DB acting like if it has a table with a huge number of columns;
    I know it's crazy but any idea please.

  • Updating tables directly from JTable

    Hi,
    Does anybody have a complete example showing how
    to read data from a table, show it on a JTable, let
    the user update its contents and finally write the
    data back to the table as he/she exits the frame ?
    Please send the code to me asap.
    Thanks a lot for the help,
    Maxsen

    I can help you out on how to use and manipulate JTable efficiently, but a forum is to be used for helping you in java, not for doing your work, so no code here.
    For your stuff, I would simply add a WindowListener in case the user close the window. Whenever that happens, the WindowListener will call some kind of a save() method. You can also add some menus and tools that will also call this method.
    I assume you know how to use JTable and WindowListener, as well as menus and toolbars in swing, ActionListener or better Action. If one of those names looks unfamiliar to you, I can provided additional informations, and yes, sample code with those explanations.

  • Standard table contents

    hello all,
      Is there any method to change the strandard table contents for example T002.
    thanks and regards,
    Mahesh

    well there are heaps of methods:
    - by coding (Update, delete, modify, ...)
    - try if there´s a maintainance-view in SM30 for that table
    - se16, and changing the sy-ucomm in debug mode
    - se16n and using "&sap_edit"
    propbably some more but those i had in mind after thinking for a short.

  • How to export table contents in xml file format through SQL queries

    hi,
    i need to export the table data in to xml file format. i got it through the GUI what they given.
    i'm using Oracle 10g XE.
    but i need to send the table name from Java programs. so, how to call the export commands from programming languages through. is there any sql commands to export the table contents in xml format.
    and one more problem is i created each transaction in two tables. for example if we have a transaction 'sales' , that will be saved in db as
    sales1 table and sales2 table. here i maintained and ID field in sales1 as PK. and id as FK in sales2.
    i get the combined data with this query,
    select * from sales1 s1, sales2 s2 where s1.id=s2.id order by s1.id;
    it given all the records, but i'm getting two ID fields (one from each table). how to avoid this. here i dont know how many fields will be there in each table. that will be known at runtime only.
    the static information is sales1 have one ID field with PK and sales2 will have one ID filed with FK.
    i need ur valuable suggestions.
    regards
    pavan.

    You can use DBMS_XMLGEN.getXML('your Query') for generating data in tables to XML format and you can use DBMS_XMLGEN.SETROWSETTAG to change the parent element name other wise it will give rowset as well as DBMS_XMLGEN.SETROWTAG for row name.
    Check this otherwise XMLELEMENT and XMLFOREST function are also there to convert data in XML format.

  • Implicit Join or Explicit Join...which is more efficient???

    Which is more efficient?
    An IMPLICIT JOIN
    SELECT TableA.ColumnA1,
    TableB.ColumnB2
    FROM TableA,
    TableB
    WHERE TableA.ColumnA1 = TableB.ColumnB1
    Or....An EXPLICIT JOIN
    SELECT TableA.ColumnA1,
    TableB.ColumnB2
    FROM TableA
    INNER JOIN TableB
    ON TableA.ColumnA1 = TableB.ColumnB1
    I have to write a pretty extensive query and there will be many parts and I just want to try and make sure it is efficient as possible. Can I EXPLAIN this in SQL Navigator as well to find out???
    Thanks in advance for your review and hopeful for a reply.
    PSULionRP

    Alex Nuijten wrote:
    The Partition Outer Join is very handy, but it's an Oracle-ism - Not ANSI ...Ooh, "New thing learnt today" - check.
    but then again who cares? ;)Oracle roolz! *{;-D                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Bapi : BAPI_ALM_ORDER_MAINTAIN not updating table AFVU-USR08

    Hi,
    I have a requirement to update table AFVU-USR08.I am actualy dealing with tcode IW32/IW33 where in we need to update operation-->enhancement tab.I am using BAPI : BAPI_ALM_ORDER_MAINTAIN to do this.I am testing the BAPI directly( Not called in any program ),I can see a message like so and so order saved under notification,But there is no entry in table AFVU-USR08.
    If any one have come across this prob. and got the sol. Pl. share it with me.
    Your solution will be more helpful.
    Thanks,
    Bharani.

    Hi Ferry,
    1. I have also tried ur given code before BAPI_TRANSACTION_COMMIT.
        l_fname = 'SOBKZ'.
        l_fvalue = 'U'.
        CALL FUNCTION 'CO_BH_MOD_SINGLE_FIELDS'
          EXPORTING
            aufnr_imp = wa_meth-objectkey(12)
            field1    = l_fname
            value1    = l_fvalue.
    but this program is giving dump for only this particular Value saying that This is PROTECTED field.
    Can anyone help me out on How to Update Special Stock Indicator on Components Tab of Maintenance Order (IW32).
    If anyone has faced such type of problem & solved it then please let me also.
    2. Which BADI to use for Updating Special Stock Indicator when we press enter on Components tab in Transaction IW32 ?..
    Thanks in advance,
    Hope to get the solution soon from all SAP gurus.
    and help will be appriciated .
    Gaurav.

  • Creating a better update table statement

    Hello,
    I have the following update table statement that I would like to make more effecient. This thing is taking forever. A little background. The source table/views are not indexed and the larger of the two only has 150k records. Any ideas on making more effecient would be appreciate.
    Thanks.
    Ryan
    Script:
    DECLARE
    V_EID_CIV_ID SBI_EID_W_VALID_ANUM_V.SUBJECT_KEY%TYPE;
    V_EID_DOE     DATE;
    V_EID_POE     SBI_EID_W_VALID_ANUM_V.POINT_OF_ENTRY%TYPE;
    V_EID_APPR_DATE DATE;
    V_CASE_CIV_ID     SBI_DACS_CASE_RECORDS.CASE_EID_CIV_ID%TYPE;
    V_CASE_DOE     DATE;          
    V_CASE_POE SBI_DACS_CASE_RECORDS.CASE_CODE_ENTRY_PLACE%TYPE;
    V_CASE_APPR_DATE           DATE;
    V_CASE_DEPART_DATE           DATE;
    V_SBI_UPDATE_STEP SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP%TYPE;
    V_SBI_CIV_ID SBI_DACS_CASE_RECORDS.SBI_CIV_ID%TYPE;
    CURSOR VALID_CIV_ID_FROM_EID IS
         SELECT EID.SUBJECT_KEY,
              TO_DATE(EID.PROCESS_ENTRY_DATE),
              EID.POINT_OF_ENTRY,
              TO_DATE(EID.APPREHENSION_DATE),
              DACS.CASE_EID_CIV_ID,
              TO_DATE(DACS.CASE_DATE_OF_ENTRY,'YYYYMMDD'),
              DACS.CASE_CODE_ENTRY_PLACE,
              TO_DATE(DACS.CASE_DATE_APPR,'YYYYMMDD'),
              TO_DATE(DACS.CASE_DATE_DEPARTED,'YYYYMMDD'),
              DACS.SBI_UPDATE_STEP,
              DACS.SBI_CIV_ID
         FROM SBI_EID_W_VALID_ANUM_V EID,
    SBI_DACS_CASE_RECORDS DACS
    WHERE DACS.CASE_NBR_A = EID.ALIEN_FILE_NUMBER;
         BEGIN          
              OPEN VALID_CIV_ID_FROM_EID;
    SAVEPOINT A;
              LOOP
                   FETCH VALID_CIV_ID_FROM_EID INTO V_EID_CIV_ID, V_EID_DOE, V_EID_POE,V_EID_APPR_DATE,V_CASE_CIV_ID, V_CASE_DOE,V_CASE_POE,V_CASE_APPR_DATE,V_CASE_DEPART_DATE,V_SBI_UPDATE_STEP,V_SBI_CIV_ID;     
    DBMS_OUTPUT.PUT_LINE('BEFORE');
                   EXIT WHEN VALID_CIV_ID_FROM_EID%FOUND;
    DBMS_OUTPUT.PUT_LINE('AFTER');
              UPDATE SBI_DACS_CASE_RECORDS
    SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_CASE_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 1
    WHERE V_CASE_CIV_ID IS NOT NULL
    AND V_CASE_CIV_ID <> 0;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 2
    WHERE V_SBI_CIV_ID IS NULL AND V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE
                   AND V_EID_APPR_DATE = V_CASE_DEPART_DATE;
                   UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 3
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 4
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4 ;
         UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 5
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE <> V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 6
    WHERE V_SBI_UPDATE_STEP = 0
                   AND V_EID_POE = V_CASE_POE
                   AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
    UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 7
    WHERE V_SBI_UPDATE_STEP = 0
         AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
              UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 8
    WHERE V_SBI_UPDATE_STEP = 0
    AND V_EID_DOE = V_CASE_DOE
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;          
                   UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 9
    WHERE V_SBI_UPDATE_STEP = 0
    AND V_EID_DOE = V_CASE_DOE
                   AND V_EID_POE = V_CASE_POE;
              UPDATE SBI_DACS_CASE_RECORDS
              SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
                   SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 10
    WHERE V_SBI_UPDATE_STEP = 0
    AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
                   AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;     
              END LOOP;
              CLOSE VALID_CIV_ID_FROM_EID;
         COMMIT;
         END;     
    -----Thats it. Thanks for your help.
    Ryan

    Please use [ code] or [ pre] tags to format code before posing:
    DECLARE
         V_EID_CIV_ID SBI_EID_W_VALID_ANUM_V.SUBJECT_KEY%TYPE;
         V_EID_DOE DATE;
         V_EID_POE SBI_EID_W_VALID_ANUM_V.POINT_OF_ENTRY%TYPE;
         V_EID_APPR_DATE DATE;
         V_CASE_CIV_ID SBI_DACS_CASE_RECORDS.CASE_EID_CIV_ID%TYPE;
         V_CASE_DOE DATE;
         V_CASE_POE SBI_DACS_CASE_RECORDS.CASE_CODE_ENTRY_PLACE%TYPE;
         V_CASE_APPR_DATE DATE;
         V_CASE_DEPART_DATE DATE;
         V_SBI_UPDATE_STEP SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP%TYPE;
         V_SBI_CIV_ID SBI_DACS_CASE_RECORDS.SBI_CIV_ID%TYPE;
         CURSOR VALID_CIV_ID_FROM_EID IS
              SELECT EID.SUBJECT_KEY,
               TO_DATE(EID.PROCESS_ENTRY_DATE),
               EID.POINT_OF_ENTRY,
               TO_DATE(EID.APPREHENSION_DATE),
               DACS.CASE_EID_CIV_ID,
               TO_DATE(DACS.CASE_DATE_OF_ENTRY,'YYYYMMDD'),
               DACS.CASE_CODE_ENTRY_PLACE,
               TO_DATE(DACS.CASE_DATE_APPR,'YYYYMMDD'),
               TO_DATE(DACS.CASE_DATE_DEPARTED,'YYYYMMDD'),
               DACS.SBI_UPDATE_STEP,
               DACS.SBI_CIV_ID
              FROM SBI_EID_W_VALID_ANUM_V EID,
               SBI_DACS_CASE_RECORDS DACS
              WHERE DACS.CASE_NBR_A = EID.ALIEN_FILE_NUMBER;
    BEGIN
         OPEN VALID_CIV_ID_FROM_EID;
         SAVEPOINT A;
    LOOP
         FETCH VALID_CIV_ID_FROM_EID INTO V_EID_CIV_ID, V_EID_DOE,
              V_EID_POE,V_EID_APPR_DATE,V_CASE_CIV_ID, V_CASE_DOE,
                   V_CASE_POE,V_CASE_APPR_DATE,V_CASE_DEPART_DATE,V_SBI_UPDATE_STEP,V_SBI_CIV_ID;
         DBMS_OUTPUT.PUT_LINE('BEFORE');
         EXIT WHEN VALID_CIV_ID_FROM_EID%FOUND;
         DBMS_OUTPUT.PUT_LINE('AFTER');
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_CASE_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 1
         WHERE V_CASE_CIV_ID IS NOT NULL
          AND V_CASE_CIV_ID <> 0;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 2
         WHERE V_SBI_CIV_ID IS NULL AND V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE
            AND V_EID_APPR_DATE = V_CASE_APPR_DATE
             AND V_EID_APPR_DATE = V_CASE_DEPART_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 3
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE
            AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 4
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE
            AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
             AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4 ;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 5
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE <> V_CASE_POE
            AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 6
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_POE = V_CASE_POE
           AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 7
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_APPR_DATE = V_CASE_APPR_DATE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 8
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
            AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 9
         WHERE V_SBI_UPDATE_STEP = 0
          AND V_EID_DOE = V_CASE_DOE
           AND V_EID_POE = V_CASE_POE;
         UPDATE SBI_DACS_CASE_RECORDS
          SET SBI_DACS_CASE_RECORDS.SBI_CIV_ID = V_EID_CIV_ID,
           SBI_DACS_CASE_RECORDS.SBI_UPDATE_STEP = 10
         WHERE V_SBI_UPDATE_STEP = 0
          AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) > -4
           AND (V_EID_APPR_DATE - V_CASE_APPR_DATE) < 4;
    END LOOP;
    CLOSE VALID_CIV_ID_FROM_EID;
    COMMIT;
    END;Peter D.

Maybe you are looking for

  • Cannot reinstall photoshop cs3 extended on vista

    I bought Photoshop PS3 Extended 4/26/07 and have been running it on a Vista PC.  I tried to launch it in 4/2011, but it said something about the license not working and to uninstall and re-install. I uninstalled and have been trying ever since to rei

  • My laptop won't turn on!!!

    Hi everyone, I left my laptop on hibernate and once I got back home it won't turn on I have a P55-A5200 laptop. What do I need to do?

  • HOLD button in the work area

    Hi All When Buyer can HOLD (button ) functionality . even we add sc item into the workarea sc is available for buyer forever . Why HOLD functionality is required for the BUYER. What is the SAP definition for thiS HOLD functionality in ****[pit work a

  • Dbms_job problem

    Hi I have a Problem In dbms_job My JOB_QUEUE_PROCESSES is Set to 10; declare jobid number; begin sys.dbms_job.submit( job => jobid, what => 'begin PRO_DNS_ALERT; commit; end;', next_date => to_date('04-04-2006 10:00:00', 'dd-mm-yyyy hh24:mi:ss'), int

  • Attachments...still screwed up

    I continue to get those that I send attachments to that say they cannot view/open my simple attachments like .jpg photos and .pdf files. This continues to be a pain in the -ss! for me and those that I send attachments to. (dozens a day!) And was NOT