Commit after deleting records

Hi All,
I wrote one delete command .This command deletes 20 millions of records.But I want to give "commit" after deleting every 100000 records. How to give "commit" for this requirement.
please guide me.
Thank you.

Depends on your delete statement.
Sometime you can group the delets into logical units.
Compare and consider the following three approaches.
1) This deletes all data from all previous months.Delete from myTable where insertDate < trunc(sysdate,'mm'))
2) Delete each month separately and commit in between.Delete from myTable where insertDate < trunc(sysdate,'year'));
commit;
Delete from myTable
where insertDate >= trunc(sysdate,'year'))
and insdate < add_months(trunc(sysdate,'year'),1) -- "january"
and insdate < trunc(sysdate,'mm')) -- do not delete too much!
commit;
Delete from myTable
where insertDate >= trunc(sysdate,'year'))
and insdate < add_months(trunc(sysdate,'year'),2) -- "February"
and insdate < trunc(sysdate,'mm')) -- do not delete too much!
commit;
Delete from myTable
where insertDate >= trunc(sysdate,'year'))
and insdate < add_months(trunc(sysdate,'year'),3) -- "March"
and insdate < trunc(sysdate,'mm')) -- do not delete too much!
commit;
Delete from myTable
where insertDate >= trunc(sysdate,'year'))
and insdate < add_months(trunc(sysdate,'year'),12) -- "December"
and insdate < trunc(sysdate,'mm')) -- do not delete too much!
commit;
3) Delete based on ID and logical groups
Select min(id), max(id) into v_min, v_max
from myTable where insertDate < trunc(sysdate,'mm'));
for i in 1..trunc(v_max-v_min)/100000)+1 loop
  delete from myTable
  where id >= v_min+((i-1)*100000)
  and id < v_min+(i*100000)
  and id <= v_max
  and insertDate < trunc(sysdate,'mm')) -- this line is not really needed, maybe remove it depending on the execution plan.
  commit;
end loop;

Similar Messages

  • Commit after 2000 records in update statement but am not using loop

    Hi
    My oracle version is oracle 9i
    I need to commit after every 2000 records.Currently am using the below statement without using the loop.how to do this?
    do i need to use rownum?
    BEGIN
    UPDATE
    (SELECT A.SKU,M.TO_SKU,A.TO_STORE FROM
    RT_TEMP_IN_CARTON A,
    CD_SKU_CONV M
    WHERE
    A.SKU=M.FROM_SKU AND
    A.SKU<>M.TO_SKU AND
    M.APPROVED_FLAG='Y')
    SET SKU = TO_SKU,
         TO_STORE=(SELECT(
              DECODE(TO_STORE,
              5931,'931',
              5935,'935',
              5928,'928',
              5936,'936'))
              FROM
              RT_TEMP_IN_CARTON WHERE TO_STORE IN ('5931','5935','5928','5936'));
    COMMIT;
    end;
    Thanks for your help

    I need to commit after every 2000 recordsWhy?
    Committing every n rows is not recommended....
    Currently am using the below statement without using the loop.how to do this?Use a loop? (not recommended)

  • Comma after variable record length

    Hi guys,
    Can you tell me if it is possible (and how I should have my control file) to process a loader file that has a comma (CSV) after the byte length? I can't get it to work.
    e.g
    Example file record:-
    00047,1,MR SMITH,20 ANY STREET, ANY ADDRESS, ANY TOWN
    COLUMNS = "ID,NAME,ADDRESS1,ADDRESS2,ADDRESS3"
    So my infile reads
    infile 'example.dat' "var 5"
    but the only examples I have of using record length is where there is no comma separating the record length from the first field, ie in this format:
    000471,MR SMITH,20 ANY STREET, ANY ADDRESS, ANY TOWN
    I cant change the input data format, so any help to cater for this is greatly appreciated.
    Thanks

    Hello, I think you need to add a FILLER field, like this:
    LOAD DATA
    INFILE 'example.dat' "VAR 5"
    TRUNCATE INTO TABLE t1
    FIELDS TERMINATED BY ','
       DUMMY FILLER,
       ID  INTEGER EXTERNAL,
       NAME  CHAR,
       ADDRESS1  CHAR,
       ADDRESS2  CHAR,
       ADDRESS3  CHAR
    )

  • Can't reclaim space in tablespace after deleting records

    Oracle 11gR1 RHEL5 64bit
    Hi.
    I am having trouble reclaiming space from a tablespace after having deleted all (thousands) of the records from a table (which resides in that tablespace). I have tried the following options to no avail:
    - Alter table <table_name> shrink
    - purge tablespace
    - purge recyclebin
    This table has several LOB columns and is using securefiles. I don't know if that has something to do with it or not. The tablespace is locally Managed and Segment space management is set to AUTO. Below is the create table command:
    CREATE TABLE IIQ.DICOM_OBJECT
    DICOM_OBJECT_RID NUMBER CONSTRAINT NN_DICOM_OBJECT_DICOM_OBJ_RID NOT NULL,
    SUBMISSION_RID NUMBER,
    SUBMISSION_ITEM_RID NUMBER,
    DICOM ORDSYS.ORDDICOM,
    IMAGETHUMB ORDSYS.ORDIMAGE,
    ANONDICOM ORDSYS.ORDDICOM,
    ACTIVE_FLAG VARCHAR2(1 CHAR) DEFAULT 'Y' CONSTRAINT NN_DICOM_OBJECT_ACTIVE_FLAG NOT NULL,
    CREATED_TIMESTAMP TIMESTAMP(6) WITH LOCAL TIME ZONE DEFAULT SYSTIMESTAMP CONSTRAINT NN_DICOM_OBJECT_TIMESTAMP NOT NULL,
    SOURCE_DESCRIPTION VARCHAR2(100 CHAR) CONSTRAINT NN_DICOM_OBJECT_SOURCE NOT NULL,
    OP_CONFORMANCE_FLAG VARCHAR2(1 CHAR)
    COLUMN IMAGETHUMB NOT SUBSTITUTABLE AT ALL LEVELS
    TABLESPACE IIQDCMDAT01
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 80K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    NOCOMPRESS
    LOB ("DICOM"."EXTENSION") STORE AS SECUREFILE
    ( TABLESPACE IIQDCMLOB01
    DISABLE STORAGE IN ROW
    CHUNK 16384
    RETENTION
    NOCACHE
    INDEX (
    TABLESPACE IIQDCMLOB01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 208K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOB (SYS_NC00050$) STORE AS
    ( TABLESPACE IIQDCMDAT01
    ENABLE STORAGE IN ROW
    CHUNK 16384
    PCTVERSION 10
    NOCACHE
    INDEX (
    TABLESPACE IIQDCMDAT01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 80K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOB ("DICOM"."SOURCE"."LOCALDATA") STORE AS SECUREFILE
    ( TABLESPACE IIQDCMLOB01
    DISABLE STORAGE IN ROW
    CHUNK 16384
    RETENTION
    NOCACHE
    INDEX (
    TABLESPACE IIQDCMLOB01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 208K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOB ("ANONDICOM"."SOURCE"."LOCALDATA") STORE AS SECUREFILE
    ( TABLESPACE IIQDCMLOB01
    DISABLE STORAGE IN ROW
    CHUNK 16384
    RETENTION
    NOCACHE
    INDEX (
    TABLESPACE IIQDCMLOB01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 208K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    XMLTYPE SYS_NC00017$ STORE AS CLOB
    ( TABLESPACE IIQDCMLOB01
    DISABLE STORAGE IN ROW
    CHUNK 16384
    RETENTION
    CACHE READS
    INDEX (
    TABLESPACE IIQDCMLOB01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 208K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOB ("IMAGETHUMB"."SOURCE"."LOCALDATA") STORE AS SECUREFILE
    ( TABLESPACE IIQDCMLOB01
    DISABLE STORAGE IN ROW
    CHUNK 16384
    RETENTION
    NOCACHE
    INDEX (
    TABLESPACE IIQDCMLOB01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 208K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOB ("ANONDICOM"."EXTENSION") STORE AS SECUREFILE
    ( TABLESPACE IIQDCMLOB01
    DISABLE STORAGE IN ROW
    CHUNK 16384
    RETENTION
    NOCACHE
    INDEX (
    TABLESPACE IIQDCMLOB01
    STORAGE (
    INITIAL 80K
    NEXT 1
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    STORAGE (
    INITIAL 208K
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOCACHE
    NOPARALLEL
    MONITORING
    ENABLE ROW MOVEMENT;
    Thank you all.

    Justin Cave wrote:
    OK, so you did a SHRINK SPACE CASCADE? Not just a SHRINK SPACE?That is correct.
    What makes you believe that there is more space that can be reclaimed? Well, what I don't understand is that when a table (and only that table) was assigned to a specific tablespace whose data was completely removed is showing as if the data is still there...at least when you look at the tablespace. If all the rows of a table are removed, then shouldn't the tablespace size go down? There was 95 GB of data in that tablespace and all from that one table, which was completely emptied. However, it still shows the tablespace as being 95GB full.
    Can you post the size of the table segment and the LOB segments as well as the size of the actual data in the table and the LOBs?Can you tell me which views you would like to the see the data from ? dba_lobs, dba_segments, etc... I want to make sure i have the right query for you.
    Here is some info...not sure if this is what you want (formatiing is off):
    select owner, segment_name, segment_type, tablespace_name, bytes
    from dba_segments
    where owner = 'IIQ'
    and tablespace_name = 'IIQDCMLOB01'
    and segment_type = 'LOBSEGMENT';
    OWNER SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME BYTES
    IIQ SYS_LOB0000651630C00012$$ LOBSEGMENT IIQDCMLOB01 9.8416E+10
    IIQ SYS_LOB0000651630C00018$$ LOBSEGMENT IIQDCMLOB01 755236864
    IIQ SYS_LOB0000651630C00021$$ LOBSEGMENT IIQDCMLOB01 755236864
    IIQ SYS_LOB0000651630C00023$$ LOBSEGMENT IIQDCMLOB01 262144
    IIQ SYS_LOB0000651630C00044$$ LOBSEGMENT IIQDCMLOB01 262144
    IIQ SYS_LOB0000651630C00053$$ LOBSEGMENT IIQDCMLOB01 262144
    OWNER TABLE_NAME
    COLUMN_NAME
    ----------------------------------- SEGMENT_NAME TABLESPACE_NAME INDEX_NAME CHUNK PCTVERSION RETENTION FREEPOOLS CACHE LOGGING ENCR COMPRE DEDUPLICATION IN_ FORMAT PAR SEC
    IIQ DICOM_OBJECT
    "DICOM"."SOURCE"."LOCALDATA"
    SYS_LOB0000651630C00012$$ IIQDCMLOB01 SYS_IL0000651630C00012$$ 16384 10800 NO YES NO NO NO NO NOT APPLICABLE NO YES
    IIQ DICOM_OBJECT
    SYS_NC00018$
    SYS_LOB0000651630C00018$$ IIQDCMLOB01 SYS_IL0000651630C00018$$ 16384 10800 CACHEREADS YES NO NO NO NO ENDIAN NEUTRAL NO YES
    IIQ DICOM_OBJECT
    "DICOM"."EXTENSION"
    SYS_LOB0000651630C00021$$ IIQDCMLOB01 SYS_IL0000651630C00021$$ 16384 10800 NO YES NO NO NO NO NOT APPLICABLE NO YES
    IIQ DICOM_OBJECT
    "IMAGETHUMB"."SOURCE"."LOCALDATA"
    SYS_LOB0000651630C00023$$ IIQDCMLOB01 SYS_IL0000651630C00023$$ 16384 10800 NO YES NO NO NO NO NOT APPLICABLE NO YES
    IIQ DICOM_OBJECT
    "ANONDICOM"."SOURCE"."LOCALDATA"
    SYS_LOB0000651630C00044$$ IIQDCMLOB01 SYS_IL0000651630C00044$$ 16384 10800 NO YES NO NO NO NO NOT APPLICABLE NO YES
    IIQ DICOM_OBJECT
    "ANONDICOM"."EXTENSION"
    SYS_LOB0000651630C00053$$ IIQDCMLOB01 SYS_IL0000651630C00053$$ 16384 10800 NO YES NO NO NO NO NOT APPLICABLE NO YES
    Thanks.

  • Commit after delete

    I have a job that process data for last 7 days. Most of data(90%) is processed in first iteration(first day) after what i delete processed data and do a commit. What is strange is that job continues to work slow as if there is same amount of data like there was before deleting. How to improve performances?

    How to improve performances?Ideally you would trace (with wait events) the session that executes your job and look at the TKPROF report to identify where time is spent and what are the performance bottlenecks in code.
    In order to do so:
    SQL> alter session set events '10046 trace name context forever, level 12'
      2  /
    Session altered.
    SQL> -- run your job code here
    SQL> -- exit when it's finished
    SQL> It will produce a .trc file in your udump directory, that you can make 'readable' by 'tkproffing' it.
    A DBA could help you with this.
    Many threads regarding tuning and interpreting and explanations on tkprof reports can be found here:
    http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%2210046%22
    You can find more information regarding TRACE/TKPROF in the Oracle Performance Tuning Guide:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/toc.htm
    You also might want to read these informative threads that will give you more hints regarding tuning/diagnosing performance problems:
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long ...
    And then you post the queries from the process and their execution plans here, as well as your database version.
    But a trace will give you much more information.

  • Commit after Delete and Merge

    Hi,
    I have a Synchronous process which deletes data from the table and then invokes an Asynchronous process that merges data into the table.
    We noticed that it takes few minutes to finish the merge and in those few minutes the table is empty as the data was deleted earlier.
    I want to know if there is a way I can commit at the very end after the merge is done so the table is not empty after the delete is done....Or is there any other way of doing this...
    Thanks and appreciate your help
    -Prapoorna

    Do it in one BPEL process, and ensure that you are using an XA datasource. The sync process is treated as a separte transaction hence is deleted at the end. If you bring it in line with the BPEL process the the merge and delete will work together in one transaction.
    cheers
    James

  • Create record issue in the JHS LOV popup window after delete record

    Jdeveloper : Studio Edition Version 11.1.2.2.0
    Jheadstart : 11.1.2.1.28
    hi
    i sent a testcase to [email protected]
    in JHS lov popup window,when i delete a record and then, i want to create a new record,it is not work
    but when i click in one of the fields and then click plus icon, it work correctly

    OK, this happens because of the code that fixed the delete issue that I sent you before. This code needs to be changed slightly, the following lines:
    Row row = selectedRowData.getRow();
    if (!isMultiSelect())
    // make this row current, so row delete will work in LOV page
    selectedRowData.getIteratorBinding().getRowSetIterator().getRowSet().setCurrentRow(row);
    selectedRows.add(new RowData(row));
    should be enclosed with a check whether there is a selected row:
    if (selectedRowData != null)
    Row row = selectedRowData.getRow();
    if (!isMultiSelect())
    // make this row current, so row delete will work in LOV page
    selectedRowData.getIteratorBinding().getRowSetIterator().getRowSet().setCurrentRow(row);
    selectedRows.add(new RowData(row));
    Steven Davelaar,
    JHeadstart team.

  • About procedure to commit after 1000 rows

    i have procedure
    and a cursor c1 is select emp table and
    insert into copy_emp table
    but i want to commit after 1000 record;
    with exception handling
    plz help me with example
    thanks

    Everything you have described is either bad practice in all currently supported versions or bad practice in every version since 7.0.12.
    Cursor loops have been obsolete since version 9.0.1.
    Incremental commiting, for example every 1,000 rows, has always been a bad practice. It slows down processing and manufactures ORA-01555 exceptions.
    For demos of how to properly process data sets look up BULK COLLECT and FORALL at http://tahiti.oracle.com and review the demos in Morgan's Library at www.psoug.org.
    For a long list of good explanations of why you should not do incremental commits read Tom Kyte's many comments at http://asktom.oracle.com.
    Incremental commits may make sense in other products. Oracle is not other products.

  • Need to commit after every 10 000 records inserted ?

    What would be the best way to Commit after every 10 000 records inserted from one table to the other using the following script :
    DECLARE
    l_max_repa_id x_received_p.repa_id%TYPE;
    l_max_rept_id x_received_p_trans.rept_id%TYPE;
    BEGIN
    SELECT MAX (repa_id)
    INTO l_max_repa_id
    FROM x_received_p
    WHERE repa_modifieddate <= ADD_MONTHS (SYSDATE, -6);
    SELECT MAX (rept_id)
    INTO l_max_rept_id
    FROM x_received_p_trans
    WHERE rept_repa_id = l_max_repa_id;
    INSERT INTO x_p_requests_arch
    SELECT *
    FROM x_p_requests
    WHERE pare_repa_id <= l_max_rept_id;
    DELETE FROM x__requests
    WHERE pare_repa_id <= l_max_rept_id;

    1006377 wrote:
    we are moving between 5 and 10 million records from the one table to the other table and it takes forever.
    Please could you provide me with a script just to commit after every x amount of records ? :)I concur with the other responses.
    Committing every N records will slow down the process, not speed it up.
    The fastest way to move your data (and 10 million rows is nothing, we do those sorts of volumes frequently ourselves) is to use a single SQL statement to do an INSERT ... SELECT ... statement (or a CREATE TABLE ... AS SELECT ... statement as appropriate).
    If those SQL statements are running slowly then you need to look at what's causing the performance issue of the SELECT statement, and tackle that issue, which may be a case of simply getting the database statistics up to date, or applying a new index to a table etc. or re-writing the select statement to tackle the query in a different way.
    So, deal with the cause of the performance issue, don't try and fudge your way around it, which will only create further problems.

  • How to refresh after delete the records in ALV report ?

    Hi Friends,
    How to refresh after delete the records in ALV report.
    I am deleting records in ALV report .
    After successful delete the screen should refresh.
    u201C Deleted records should not appear in the screen u201C.
    Please guide me.
    Regards,
    Subash

    Hi subhash,
    FORM user_command USING r_ucomm LIKE sy-ucomm      rs_selfield TYPE slis_selfield.
    WHEN 'BACK'.
    Refresh the internal table from the ALV grid
          PERFORM update_alv_tab.
    ENDFORM.                    "user_command
    FORM update_alv_tab .
      DATA :  e_grid TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = e_grid.
      CALL METHOD e_grid->check_changed_data.
      "update_alv_tab
      CALL METHOD e_grid->refresh_table_display.
    ENDFORM.                    " UPDATE_ALV_TAB
    Then see in Debug mode is it updating or not..
    Please confirm .
    And please paste the code if you can.
    Regards.

  • Sending email after deleting the records in a table

    Hi
    I am deleting the records in a table. After deleting the records,
    i want to send an email to another person. I am planning to follow this steps.
    1. Create a trigger on the table(AFTER DELETE ON table FOR EACH ROW)
    to copy the deleted records to temporary table.
    2. Read the temporary table and send an email.
    Is there any other way we can do with out creating temporary table ?.
    Govind

    I don't know what you plan to use to send the mail but here's a solution that would work.
    -- Create a send mail procedure
    create or replace procedure send_mail (
    sender      IN VARCHAR2,
    recipient   IN VARCHAR2,
    message     IN VARCHAR2)
    IS
      mailhost VARCHAR2(30) := 'localhost';
      mail_conn utl_smtp.connection;
    BEGIN
    mail_conn :=  utl_smtp.open_connection(mailhost, 25);
      utl_smtp.helo(mail_conn, mailhost);
      utl_smtp.mail(mail_conn, sender);
      utl_smtp.rcpt(mail_conn, recipient);
      utl_smtp.data(mail_conn, message);
      utl_smtp.quit(mail_conn);
    END;
    /-- Create the trigger to email deleted rows
    create or replace trigger email_del_rows
    after delete on <table>
    for each row
    declare
    msg varchar2(2000);
    begin
    msg := 'COL1  COL2  COMPANY NAME  DATE'||chr(10);
    msg := msg||:old.col1||'    '||:old.col2||'    '||:old.company_name||'       '||:old_date|| chr(10);
    msg := msg||'END OF FILE';
    send_mail('SENDER','[email protected]',msg);
    end;
    /You can make it look pretty but you get the basic idea.

  • Re: Displaying Current Record After Delete

    Hi all,
    I am using Jdeveloper 11.1.2.3.0
    I have two tables which has parent child relation among the both.
    I dragged the parent table as a adf form on to the .jspx page.
    Now if i am trying to delete fifth record in the parent table it is giving error message like "Table has child record, delete unsuccessful"
    It is fine, but the control going to first record after deletion.
    But i want to display current deleting record on the page if deletion is unsuccessful.
    Can anybody help me to resolve the above one.
    Thanks,
    Syam

    In this code when the bolded if condition fails i want to delete that record. I tried "delete struct1 index sy-tabix" but that record is not deleted.
    I tried "clear  struct1 ". its deletes the current record.
    but in some field its getting zero value & it is appending as a additional record.
    Please help me.
    loop at cdhdr.
    if ( it1-tcode = 'FSS0' or it1-tcode = 'FS00' ).
        w1_saknr = it1-objectid+4(10).
        w_orgid = it1-objectid+14(4).
       loop at it_cdpos  where changenr eq it1-changenr
                      and objectid eq it1-objectid
                       and   objectclas eq it1-objectclas.
       <b>If w_orgid in r_orgid.</b> 
      IF ( it_CDPOS-FNAME = 'XLOEV' AND it_cdpos-value_new eq 'X' ).
         replace struct1-change_ind with 'D' into struct1-change_ind.
                struct1-bukrs = w_orgid.
                struct1-cost = space.
                struct1-plant = space.
                append struct1.
          else.
             struct1-bukrs = w_orgid.
             struct1-change_ind = w_chngid.
             struct1-cost = space.
             struct1-plant = space.
             append struct1.
          endif.
       <b> else</b>.
        <b>delete struct1 index sy-tabix</b>.
      endif.
        append struct1.
           endloop.
    endif.
    endloop.

  • Getting Problem after Deleting a record from Record Store

    I am trying to create a simple application for mobile device. This application storing some records. I used RMS for this. These records i show in a list. But i tried to show list of records after deleting any record then list shows only prior records of deleted records n then shows exception as
    Recordsjavax.microedition.rms.InvalidRecordIDException
    The code i written as follows
    For storing data
    public void storeExercise(String EName, String Etime)
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    try
    byte[] outputRecord;
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    DataOutputStream outputdataStream = new DataOutputStream(outputStream);
    outputdataStream.writeUTF(EName);
    outputdataStream.writeUTF(Etime);
    outputdataStream.flush();
    outputRecord = outputStream.toByteArray();
    recordstore.addRecord(outputRecord, 0, outputRecord.length);
    outputStream.reset();
    outputStream.close();
    outputdataStream.close();
    zlist.append(EName+Etime, null);
    display.setCurrent(zlist);
    catch (Exception error)
    System.out.println("Exception in writing Records"+error);
    for getting records
    public void getExercise(ZimList zlist)
    this.zlist = zlist;
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    //recordstore.closeRecordStore();
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    try
    //System.out.println("Hello");
    String Ename = null;
    String Etime = null;
    byte[] byteInputData = new byte[100];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    for (int x=1; x<= recordstore.getNumRecords() ; x++ )
    System.out.println("Record Id ="+x);
    //if (x != InvalidRecordID)
    recordstore.getRecord(x, byteInputData, 0);
    Ename = inputDataStream.readUTF();
    Etime = inputDataStream.readUTF();
    inputStream.reset();
    Final = Ename + Etime;
    System.out.println("Insert" + Final);
    zlist.insert(x-1,Final,null);
    inputStream.close();
    inputDataStream.close();
    //recordstore.closeRecordStore();
    catch (Exception error)
    System.out.println("Exception in Reading Records"+error);
    /*if (recordstore.listRecordStores() != null)
    try
    recordstore.deleteRecordStore("My Record Store");
    catch (Exception error)
    System.out.println("Exception"+error);
    And for deleting records I write
    public void deleteExercise(int index)
    try
    //System.out.println("AAAA");
    recordstore = RecordStore.openRecordStore("Test3",true);
    //recordstore.closeRecordStore();
    catch (Exception error)
    //System.out.println("EEEE");
    System.out.println("Exception"+error);
    if (recordstore.listRecordStores() != null)
    try
    byte[] byteInputData = new byte[100];
    ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
    DataInputStream inputDataStream = new DataInputStream(inputStream);
    for (int x=1; x<= recordstore.getNumRecords() ; x++ )
    recordstore.getRecord(x, byteInputData, 0);
    if (x == index)
    recordstore.deleteRecord(index);
    //x--;
    inputStream.reset();
    break;
    inputStream.close();
    inputDataStream.close();
    catch (Exception error)
    System.out.println("Exception in Deleting Records"+error);
    Please Help me bcz i am new in j2me development n having no experience

    Ok ...
    When you add records in you store, the J2ME implementation create an ID.
    In the database, there is a list like that with ID <--> ]byte[ ]
    You can get back a record with a this ID.
    When you delete a record, it deletes the row. Lets say you have stored 3 records and that the ID are 1, 2, 3 ... if you delete the second one, then you have still in the database IDs 1 and 3.
    That's why you have this exception : you are iterating with an ID 1, 2, 3, 4, 5 ... if one is delete there is no reorganization. (If you add an other record, it could be stored with ID 2).
    To read all the records, you should get a list of existing IDs. Take a look at the API. Here is a piece of code, that you work but I have not tested :
    RecordStore rs;
    RecordEnumeration re = rs.enumerateRecords(null, null, false);
    while (re.hasNextElement()) {
      String str = new String(re.nextRecord());
      System.out.println("Record: " + str);         
    } Hope it will help you.
    Regards

  • Table grows to 6 GB with 6k records only after Delete ORA-01653:

    Hello,
    I have a Table that i delete data from using
    DELETE FROM DJ_20255_OUTPUT a where trunc(a.LOADED_DATE) <trunc(sysdate -7);
    COMMIT;
    the issue i have is when i want to repopulate the table i get the Error ORA-01653: unable to extend table.
    The table grows to over 6gb but if i truncate that table and in both cases there is no data left in the table after either action the table will only grow to 0.8 Mb once populated.
    so with truncate table size is 0.8MB and if i use delete from.... the table grows to 6GB
    The repopulation of the table uses mutiple insert statments commiting after each one.
    is this a bug or is there an action i should perform onece I have deleted the data?
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi

    Is this an Index Organized table ? (select IOT_TYPE from user_tables where table_name = 'DJ_20255_OUTPUT' ;)
    Are you saying that you use this sequence :
    DELETE .... in one single call to delete all the rows
    INSERT ... in multiple calls with COMMIT after each row
    Hemant K Chitale

  • After deletion of record the dialog page is coming back to source page

    Dear all
    Good Morning
    i have creation page user will enter it will call to view mode,in that user will click on edit button again it will call to creation page with editable mode.
    in that creation page editable mode user click on delete button it willl call to dialog page buttons "Yes" AND "NO"
    user will click on yes the record is deleted but again after deletion of record again it is calling to creation page and creating blank record
    but my requirement is after click on yes button it will delete the record and navigate to search page
    how is it?
    in my case again it is coming to creation page.
    /*in edit page user click on delete button it will call to dialog page*/
    if ("Delete".equals(pageContext.getParameter(EVENT_PARAM)))
    String oid = pageContext.getParameter("oid");
    OAException msg = new OAException("PO", "XX_DELETE_SUPPSITE_CONFIRM");
    OADialogPage dpage =
    new OADialogPage(OAException.WARNING, msg, null, "", "");
    dpage.setOkButtonToPost(true);
    dpage.setOkButtonLabel("Yes");
    dpage.setOkButtonItemName("DeleteYes");
    dpage.setPostToCallingPage(true);
    dpage.setNoButtonToPost(true);
    dpage.setNoButtonItemName("DeleteNo");
    Hashtable ht = new Hashtable(1);
    ht.put("d1", oid);
    dpage.setFormParameters(ht);
    pageContext.redirectToDialogPage(dpage);
    /*If user click on No button it will call to editable mode*/(previuos page)
    if(pageContext.getParameter("DeleteNo")!=null)
    System.out.println("User will click on this button....");
    String oppoid = (String)pageContext.getSessionValue("xxoppoid");
    HashMap hp=new HashMap();
    hp.put("Purpose","Edit");
    hp.put("oppoid",oppoid);
    pageContext.setForceForwardURL("OA.jsp?page=/crm/oracle/apps/xxcrm/crmmgmt/quotationmgmt/webui/xxcrmquotationcreationPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, hp, false, null,
    OAWebBeanConstants.IGNORE_MESSAGES);
    /*if user will click on delete yes button*/ after delete i want to call search page but it is going to search page internally it is coming to creation page and blank record is created.*/
    if (pageContext.getParameter("DeleteYes") != null)
    String s1 = pageContext.getParameter("d1");
    am.xxDeleteQuotation(s1);
    pageContext.setForceForwardURL("OA.jsp?page=/crm/oracle/apps/xxcrm/crmmgmt/quotationmgmt/webui/xxcrmquotationsearchPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null, null, true, null,
    OAWebBeanConstants.IGNORE_MESSAGES);
    I hope u understand my question
    Regards
    Sreekanth

    Hi Gaurav,
    Already i am using what u saying that way.
    That way also,am getting the error
    My Co Code is,
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    xxcrmItemMgmtAMImpl am = (xxcrmItemMgmtAMImpl)pageContext.getApplicationModule(webBean);
    String valid = pageContext.getParameter("Dialog");
    System.out.println("the value of valid is"+valid);
    if(valid!=null)
    pageContext.setForwardURL("OA.jsp?page=/crm/oracle/apps/xxcrm/crmmgmt/quotationmgmt/webui/xxcrmItemsAddPG",
    null,
    OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,null,false,OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
    OAWebBeanConstants.IGNORE_MESSAGES);
    String itemid=pageContext.getParameter("itemid");
    pageContext.putSessionValue("itemid",itemid);
    System.out.println("the item id in additem viewco is"+itemid);
    am.xxeditAddItem(itemid);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    xxcrmItemMgmtAMImpl am = (xxcrmItemMgmtAMImpl)pageContext.getApplicationModule(webBean);
    if("Delete".equals(pageContext.getParameter(EVENT_PARAM))) {
    String itemid=pageContext.getSessionValue("itemid").toString();
    OAException msg=new OAException("PO","XX_DELETE_SUPPSITE_CONFIRM");
    OADialogPage dpage=new OADialogPage(OAException.WARNING,
    msg,null,"","");
    System.out.println("this is delete block1");
    dpage.setOkButtonToPost(true);
    dpage.setOkButtonLabel("Yes");
    dpage.setOkButtonItemName("DeleteYes");
    dpage.setPostToCallingPage(true);
    dpage.setNoButtonToPost(true);
    Hashtable ht=new Hashtable();
    ht.put("d1",itemid);
    dpage.setFormParameters(ht);
    pageContext.redirectToDialogPage(dpage);
    System.out.println("this is delete block2");
    if(pageContext.getParameter("DeleteYes")!=null) {
    String itemid=pageContext.getParameter("d1");
    Serializable[] d1={itemid};
    am.invokeMethod("xxDeleteItem",d1);
    HashMap hm=new HashMap();
    hm.put("Dialog","Yes");
    String test=hm.get("Dialog").toString();
    System.out.println("the dialog page value is"+test);
    pageContext.forwardImmediatelyToCurrentPage(hm,false,null);
    }

Maybe you are looking for

  • Iif() sql statement is not working please help. An expression of non boolean type specified the context

    the following sql is not working . If  sum(salary) = null   should be displayed  1 or 0 select empname,iif((isnull(sum(salary),0)),1,0) from salary group by empname regards Pol polachan

  • BTE 1830 not triggered during F110 proposal run

    Hi, I am implementing 1830 (PAYMENT PROGRAM: Edit Group)  to trigger at the time of proposal run in F110. But it's not triggering at the proposal run in F110. I have assigned 1830 custom function module to BTE 1830 FIBF > Setting > Process Modules >

  • Access dynamicConfiguration in PI7.1 userdefined Mapping

    Hi All, how can i access the DynamicConfiguration for reading the adapter specific message attributes in a user defined mapping in PI7.1. when trying to do it like in PI7.0 i get an exception that the parameter with the key StreamTransformationConsta

  • SAP FSCM-Biller Direct

    Hello, Is anyone aware of wheather Biller Direct provide functionality of scheduling of payment(future date)? Thanks in advance! Regards, Ricky

  • Where has the SDM GUI gone?

    In NW 6.1 you could {un,re}-deploy EARs not only through Developer Studio but also via a standalone SDM GUI (remotegui.bat/remotegui.sh). Has this handy tool been abandoned in CE 7.1?