How to Prevent the Duplicate record insertion by JDBC Receiver?

HI Experts,
I have File Sender to JDBC Receiver scenario.I am using SAP PI 7.1 system.
Purpose of this Scenario is to read the data from specified file and INSERT or  UPDATE the same records in Oracle Database.
Before inserting the data I want to check in the same table for prventing runtime error(Key fields Duplicatin).
So if records with the same key fields are available in table then I want to UPDATE the same record instead of INSERT.
Please Suggest me the poosbile way.
Thanks & Regards
Jagesh

Hi Jagdesh,
The JDBC receiver format has the following structure
<root>
<StatementName1>
<dbTableName action=u201DUPDATEu201D | u201CUPDATE_INSERTu201D>
<table>Table1</table>
<access>
<col1>val1</col1>
<col2>val2new</col2>
</access>
<key>
<col2>val2old</col2>
<col4>val4</col4>
</key>
This structure creates a query in this way :
UPDATE( OR UPDATE_INSERT) into Table1 set col1=val1 and col2 = val2new WHERE col2=val2old and col4=val4.
The key field works like a Where clause. So for the receiver format when you specify the key, it checks the DB with that field as the where criteria. Hence for a UPDATE_INSERT query, when you specify the key field, it checks whether that value specified within the key field exists in the DB or not. Then it proceeds to execute the statement for only those values.
Hence it makes sense to provide a primary key attribute in the key field of the JDBC receiver format.
Regards,
Kshitij

Similar Messages

  • How to retrieve the duplicates records.

    Hi friends,
         My next issue, how to retrieve the duplicate records in web intelligence.I checked the option Retrieve duplicate records in web intelligence as well.But it is not helping me.
    Hope you guys are help to solve this issue.
    Thanks lot,
    Regards,
    -B-

    hi Blaji,,
    ive tried this here and it worked perfectly with me
    even so, you dont need to make the QTY as a dimension, you can leave it as a measure also, and it will work good with you.
    click the block on the WebI, the Block itself.
    and find its properties, under "Display", you will find
    "Avoid Duplicate row Aggregations"
    in the query it self you should flag "Retrieve Duplicated Rows"
    i think this will work fine with you
    good luck
    Amr

  • How to delete the duplicate records in a table without promary key

    I have a table that contains around 1 million records and there is no promary key or auto number coulums. I need to delete the duplicate records from this table. what is the simple effective way to do this.

    Please see this link:
    Remove duplicate records ...
    sqldevelop.wordpress.com

  • How to remove the duplicate record in DART Extract

    Hi Guys,
    We are getting duplicate record when we do validate the DART extract file through DATA VIEWS for FI General Ledger Account Balances. If any one have experance on this, pls help us.
    Following are the steps we done to Validate the DART EXTRACT File for FI General Ledger Account Balances.
    1. We have run the DART extract program to extract the data from table to directory file by period vice in T.code FTW1A.
    2. When we do validate the data from DART extract file through DATA VIWE for FI General Ledger Account Balances in T.code FTWH, getting duplicate record.
    We unable to find out from where the duplicate records are coming out. will be great if any one can help us immediately.
    Thanks & Records,
    Boobalan,v

    If the dup records are actually in the DART View versus the DART Extract, you could try OSS Note 1139619 DART: Eliminate duplicate records from DART view.
    Additional Note - 1332571 FTWH/FTWY - Performance for "Eliminate duplicate records
    Colleen
    Edited by: Colleen Geraghty on May 28, 2009 6:07 PM

  • TS3276 On received mail, I delete sender's name, address, etc. then forward it.  The forwarded mail has a duplicate of the original mail, show original sender's name, etc.  How to prevent the duplicate from being sent?

    How to prevent duplicate of orginal mail (with original sender's name, address) being "attached" when forwarded?

    Maybe I am mis-understanding what you are seeing.
    When I forward a message, the receiver will see the original mail (unless I edit it, such as removing any previous sender's information) and the length will be the same as the message was before forwarding except for the added line "Begin forwarded message" (again, unless I edit bits out), and there will be no attached copy of the original message.
    So when you say in your reply above "The orginal email with the sender's name and address was also sent with my forwarded email." do you mean:
    a) that it is still visible at the head of the text of the message (which I was saying does not happen for me because "after hitting delete, the previous sender's information disappears." [and since] "it has disappeared, it cannot be in your forwarded mail." Disappeared means it is not there.
    b) another copy of the original message is attached to the forwarded email at the end, either as an included file or as repeated text.
    c) some other situation.
    Sorry about the previous mis-spellings! I hope that we can get to the bottom of this.

  • How to determine the last record inserted

    hi
    I have a table abc ( x number, y number, z date ) columns, there
    is no primary or unique key.
    I have been inserting values into it. there r some duplicate
    values to.
    but now I want to modify only the record inserted at the end.
    i.e
    if initially ABC is having
    x y z
    10 20 01-nov-2001
    11 20 01-nov-2001
    out of these records I want to change the value of x to 50 for
    the record which was inserted last or shall I say whose z is the
    greatest.
    I have been trying to do but what I see that the z column is not
    getting the time in increasing order. i.e even though I tried to
    display the dated in dd-mon-yyyy 24hh:mm:ss format still and I
    found that date is not consistant. the record I inserted first
    is have a much more value than the record I inserted last.
    please help...
    Sreekant

    rowid refers to the current position of the record; if the
    record has been moved (and there are any number of reasons why
    the database might shift a record) the order of rowid will not
    reflect the order of insertion.
    the only way to guarantee order of insertion is to timestamp the
    record. if I understand the original posting, you have been
    doing this.
    Now you should have been using SYSDATE. if you are saying that
    SYSDATE is giving you inconsistent results then you have a real
    problem: has somebody been tinkering with your database server -
    changing the system clock or something?
    Or are you using some other method to set the value for Z
    column? If so, what?
    rgds, APC

  • How to Select the duplicate records in the table

    Hi
    SELECT * FROM gin A WHERE A.sale_order_id IN (
    SELECT sale_order_id FROM gin GROUP BY sale_order_id
    HAVING COUNT(sale_order_id)>1)
    AND A.ROWID!=MIN (ROWID))
    ERROR at line 4:
    ORA-00934: group function is not allowed here
    Thanks
    Vikas Singhal

    Try this out
    select *
    from gin a
    where a.rowid > any (select b.rowid
    from gin b
    where a.col1 = b.col1
    and a.col2 = b.col2);
    Regards
    Ozy
    [www.oraclevillage.com]
    Edited by: Ozy on Feb 4, 2009 4:12 AM

  • Preventing the Duplicate Form Submission??

    Hi,
    How to prevent the duplicate form from been submitted without disabling the back button in IE???
    Thanks,
    JavaCrazyLover

    I had the same wonder. I found the following articles are quite helpful. They give detailed background info, a design pattern to deal with it, and a Struts implementation.
    http://www.theserverside.com/articles/content/RedirectAfterPost/article.html
    http://www.theserverside.com/articles/content/RedirectAfterPost2/article.html
    Cheers,
    littlemonster

  • How to find out duplicate record contained in a flat file

    Hi Experts,
    For my project I have written a program for flat file upload.
    Requirement 1
    In the flat file there may be some duplicate record like:
    Field1   Field2
    11        test1
    11        test2
    12        test3
    13        test4
    Field1 is primary key.
    Can you please let me know how I can find out the duplicate record.
    Requirement 2
    The flat file contains the header row as shown above
    Field1   Field2
    How our program can skip this record and start reading / inserting records from row no 2 ie
    11        test1
    onwards.
    Thanks
    S
    FORM upload1.
    DATA : wf_title TYPE string,
    lt_filetab TYPE filetable,
    l_separator TYPE char01,
    l_action TYPE i,
    l_count TYPE i,
    ls_filetab TYPE file_table,
    wf_delemt TYPE rollname,
    wa_fieldcat TYPE lvc_s_fcat,
    tb_fieldcat TYPE lvc_t_fcat,
    rows_read TYPE i,
    p_error TYPE char01,
    l_file TYPE string.
    DATA: wf_object(30) TYPE c,
    wf_tablnm TYPE rsdchkview.
    wf_object = 'myprogram'.
    DATA i TYPE i.
    DATA:
    lr_mdmt TYPE REF TO cl_rsdmd_mdmt,
    lr_mdmtr TYPE REF TO cl_rsdmd_mdmtr,
    lt_idocstate TYPE rsarr_t_idocstate,
    lv_subrc TYPE sysubrc.
    TYPES : BEGIN OF test_struc,
    /bic/myprogram TYPE /bic/oimyprogram,
    txtmd TYPE rstxtmd,
    END OF test_struc.
    DATA : tb_assum TYPE TABLE OF /bic/pmyprogram.
    DATA: wa_ztext TYPE /bic/tmyprogram,
    myprogram_temp TYPE ziott_assum,
    wa_myprogram TYPE /bic/pmyprogram.
    DATA : test_upload TYPE STANDARD TABLE OF test_struc,
    wa2 TYPE test_struc.
    DATA : wa_test_upload TYPE test_struc,
    ztable_data TYPE TABLE OF /bic/pmyprogram,
    ztable_text TYPE TABLE OF /bic/tmyprogram,
    wa_upld_text TYPE /bic/tmyprogram,
    wa_upld_data TYPE /bic/pmyprogram,
    t_assum TYPE ziott_assum.
    DATA : wa1 LIKE test_upload.
    wf_title = text-026.
    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
    window_title = wf_title
    default_extension = 'txt'
    file_filter = 'Tab delimited Text Files (*.txt)'
    CHANGING
    file_table = lt_filetab
    rc = l_count
    user_action = l_action
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    OTHERS = 3. "#EC NOTEXT
    IF sy-subrc 0.
    EXIT.
    ENDIF.
    LOOP AT lt_filetab INTO ls_filetab.
    l_file = ls_filetab.
    ENDLOOP.
    CHECK l_action = 0.
    IF l_file IS INITIAL.
    EXIT.
    ENDIF.
    l_separator = 'X'.
    wa_fieldcat-fieldname = 'test'.
    wa_fieldcat-dd_roll = wf_delemt.
    APPEND wa_fieldcat TO tb_fieldcat.
    CALL FUNCTION 'MESSAGES_INITIALIZE'.
    CLEAR wa_test_upload.
    Upload file from front-end (PC)
    File format is tab-delimited ASCII
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = l_file
    has_field_separator = l_separator
    TABLES
    data_tab = i_mara
    data_tab = test_upload
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    IF sy-subrc 0.
    EXIT.
    ELSE.
    CALL FUNCTION 'MESSAGES_INITIALIZE'.
    IF test_upload IS NOT INITIAL.
    DESCRIBE TABLE test_upload LINES rows_read.
    CLEAR : wa_test_upload,wa_upld_data.
    LOOP AT test_upload INTO wa_test_upload.
    CLEAR : p_error.
    rows_read = sy-tabix.
    IF wa_test_upload-/bic/myprogram IS INITIAL.
    p_error = 'X'.
    MESSAGE s153 WITH wa_test_upload-/bic/myprogram sy-tabix.
    CONTINUE.
    ELSE.
    TRANSLATE wa_test_upload-/bic/myprogram TO UPPER CASE.
    wa_upld_text-txtmd = wa_test_upload-txtmd.
    wa_upld_text-txtsh = wa_test_upload-txtmd.
    wa_upld_text-langu = sy-langu.
    wa_upld_data-chrt_accts = 'xyz1'.
    wa_upld_data-co_area = '12'.
    wa_upld_data-/bic/zxyzbcsg = 'Iy'.
    wa_upld_data-objvers = 'A'.
    wa_upld_data-changed = 'I'.
    wa_upld_data-/bic/zass_mdl = 'rrr'.
    wa_upld_data-/bic/zass_typ = 'I'.
    wa_upld_data-/bic/zdriver = 'yyy'.
    wa_upld_text-langu = sy-langu.
    MOVE-CORRESPONDING wa_test_upload TO wa_upld_data.
    MOVE-CORRESPONDING wa_test_upload TO wa_upld_text.
    APPEND wa_upld_data TO ztable_data.
    APPEND wa_upld_text TO ztable_text.
    ENDIF.
    ENDLOOP.
    DELETE ADJACENT DUPLICATES FROM ztable_data.
    DELETE ADJACENT DUPLICATES FROM ztable_text.
    IF ztable_data IS NOT INITIAL.
    CALL METHOD cl_rsdmd_mdmt=>factory
    EXPORTING
    i_chabasnm = 'myprogram'
    IMPORTING
    e_r_mdmt = lr_mdmt
    EXCEPTIONS
    invalid_iobjnm = 1
    OTHERS = 2.
    CALL FUNCTION 'MESSAGES_INITIALIZE'.
    **Lock the Infoobject to update
    CALL FUNCTION 'RSDG_IOBJ_ENQUEUE'
    EXPORTING
    i_objnm = wf_object
    i_scope = '1'
    i_msgty = rs_c_error
    EXCEPTIONS
    foreign_lock = 1
    sys_failure = 2.
    IF sy-subrc = 1.
    MESSAGE i107(zddd_rr) WITH wf_object sy-msgv2.
    EXIT.
    ELSEIF sy-subrc = 2.
    MESSAGE i108(zddd_rr) WITH wf_object.
    EXIT.
    ENDIF.
    *****Update Master Table
    IF ztable_data IS NOT INITIAL.
    CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
    EXPORTING
    i_iobjnm = 'myprogram'
    i_tabclass = 'M'
    I_T_ATTR = lt_attr
    TABLES
    i_t_table = ztable_data
    EXCEPTIONS
    attribute_name_error = 1
    iobj_not_found = 2
    generate_program_error = 3
    OTHERS = 4.
    IF sy-subrc 0.
    CALL FUNCTION 'MESSAGE_STORE'
    EXPORTING
    arbgb = 'zddd_rr'
    msgty = 'E'
    txtnr = '054'
    msgv1 = text-033
    EXCEPTIONS
    OTHERS = 3.
    MESSAGE e054(zddd_rr) WITH 'myprogram'.
    ELSE.
    CALL FUNCTION 'MESSAGE_STORE'
    EXPORTING
    arbgb = 'zddd_rr'
    msgty = 'S'
    txtnr = '053'
    msgv1 = text-033
    EXCEPTIONS
    OTHERS = 3.
    ENDIF.
    *endif.
    *****update Text Table
    IF ztable_text IS NOT INITIAL.
    CALL FUNCTION 'RSDMD_WRITE_ATTRIBUTES_TEXTS'
    EXPORTING
    i_iobjnm = 'myprogram'
    i_tabclass = 'T'
    TABLES
    i_t_table = ztable_text
    EXCEPTIONS
    attribute_name_error = 1
    iobj_not_found = 2
    generate_program_error = 3
    OTHERS = 4.
    IF sy-subrc 0.
    CALL FUNCTION 'MESSAGE_STORE'
    EXPORTING
    arbgb = 'zddd_rr'
    msgty = 'E'
    txtnr = '055'
    msgv1 = text-033
    EXCEPTIONS
    OTHERS = 3.
    ENDIF.
    ENDIF.
    ELSE.
    MESSAGE s178(zddd_rr).
    ENDIF.
    ENDIF.
    COMMIT WORK.
    CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'
    EXPORTING
    i_chabasnm = 'myprogram'
    IMPORTING
    e_chktab = wf_tablnm
    EXCEPTIONS
    name_error = 1.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ****Release locks on Infoobject
    CALL FUNCTION 'RSDG_IOBJ_DEQUEUE'
    EXPORTING
    i_objnm = 'myprogram'
    i_scope = '1'.
    ENDIF.
    ENDIF.
    PERFORM data_selection .
    PERFORM update_alv_grid_display.
    CALL FUNCTION 'MESSAGES_SHOW'.
    ENDFORM.

    Can you please let me know how I can find out the duplicate record.
    you need to split the records from flat file structure into your internal table ans use a delete ADJACENT duplicates comparing fields
    split flat_str into wa_f1 wa_f2 wa_f2 at tab_space.

  • How to restrict the duplicate values in lov column of VO based Adv Table

    Hi Gurus,
    I want to restrict the duplicate values at lov which is a colunm in an Adv Table.
    If user enters duplicate values then first it should show an error msg that Duplicate values have been entered.
    After the duplicate values have been removed, then the user can save all the values in the table.
    My Adv Table is based on a VO.
    The link how to restrict the duplicate values at form level
    talks about Adv Table based on a EoVO, which doesnot work in my case.
    My Approach,
    I am iterating through RowSetIterator and committing through PROCEDURE.
    I am able to avoid duplicate entry through a function checkRespId. (given below)
    Below code is for iterating and committing.
    public void saveline(String reqid,String userid)
    System.out.println("RequestId/saveline"+reqid);
    System.out.println("UserId/saveline"+userid);
    OAViewObject vo = (OAViewObject)getRespLineVO1();
    RespLineVORowImpl row = null;
    int fetchedRowCount = vo.getFetchedRowCount();
    RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
    if (fetchedRowCount > 0)
    deleteIter.setRangeStart(0);
    deleteIter.setRangeSize(fetchedRowCount);
    for (int i = 0; i < fetchedRowCount; i++)
    System.out.println("Inside the for LOOP");
    row = (RespLineVORowImpl)deleteIter.getRowAtRangeIndex(i);
    String respoidid = row.getAttribute("ResponsibilityId")+"";
    String respname = row.getAttribute("ResponsibilityName")+"";
    String stdate = row.getAttribute("StartDate")+"";
    String enddate = row.getAttribute("EndDate")+"";
    String linestatus ="A";
    if(userid!=null)
    if(!(respoidid.equals("null")) && respoidid!=null)
    String checkingrespid=null;
    checkingrespid = checkRespId(userid,respoidid);+contains no if not duplicate and yes if its duplicate+
    System.out.println("checkingrespid for Resp with ID :"+respoidid+"exists or not "+checkingrespid);
    if(checkingrespid.equals("No"))
         String message, result = null;
    Connection txn = getOADBTransaction().getJdbcConnection();
    try
    calling PROC ...
    catch(Exception e)
    message = "Error in Inserting into line" + e;
    throw new OAException(message, OAException.ERROR);
    else
    throw new OAException("You have entered duplicate no. of values", OAException.ERROR);
    else
    System.out.println("respoidid is null");
    break;
    deleteIter.closeRowSetIterator();
    public String checkRespId(String userid,String respoidid)
    String createRow="No";
    OAViewObject vo = (OAViewObject)findViewObject("CheckRespVO1");
    if (vo != null)
    vo.setWhereClauseParams(null);
    vo.setWhereClauseParam(0, userid);
    vo.setWhereClauseParam(1, respoidid);
    vo.executeQuery();
    System.out.println("ROW COUNT IS "+vo.getRowCount());
    if(vo.getRowCount()>0)
    createRow="Yes";
    else
    createRow="No";
    return createRow;
    Problem:
    I remove the duplicate entries and click on save and get this error.
    Unable to perform transaction on the record. \nCause: The record contains stale data. The record has been modified by another user.
    \nAction: Cancel the transaction and re-query the record to get the new data.
    Thanks,
    Sombit

    Hi Anil,
    I am trying out your code but stuck in inserting the rows
    using your code in URL: http://oracleanil.blogspot.com/2010/09/oaf-passing-table-type-object-to-oracle.html
    I am always getting the same exception i.e COde blast in when I run.
    My modified code is:
    String[] as = null;
    Number[] vNumber = null;
    Number[] vNumberrespid = null;
    Number reqidnumber = null;
    reqidnumber = new Number(Integer.parseInt(reqid));
    Connection txn = getOADBTransaction().getJdbcConnection();
    String mCreateSearchRequestStatement = null;
    OAViewObject vo = (OAViewObject)findViewObject("RespLineVO1");
    int j = vo.getFetchedRowCount();
    try
    System.out.println("abouce try");
    vo.reset();
    if (vo.getFetchedRowCount() > 0)
    System.out.println(String.valueOf("Fetched row count ").concat(String.valueOf(vo.getFetchedRowCount())));
    int i = 0;
    as = new String[j];
    vNumber = new Number[j];
    vNumberrespid = new Number[j];
    while (vo.hasNext())
    vo.next();
    System.out.println(String.valueOf("Inisde the do while loop").concat(String.valueOf(i)));
    vNumber[i] = (reqidnumber);
    vNumberrespid = ((Number)vo.getCurrentRow().getAttribute("ResponsibilityId"));
    as[i] = String.valueOf(vo.getCurrentRow().getAttribute("ResponsibilityName")).concat(String.valueOf(""));
    System.out.println("Request ID "+reqidnumber[i]);//getting null even there is some value selected
    System.out.println("ResponsibilityId "+vNumberrespid[i]);//getting null even there is some value selected
    System.out.println("Resp Name "+as[i] );//getting null even there is some value selected
    i++;
    CallableStatement cs = txn.prepareCall("{call XX_PassTableType.XX_PassTableType_prc(:1, :2,:3)}");
    ARRAY array = new ARRAY(new ArrayDescriptor("APPS.JTF_NUMBER_TABLE", txn), txn, vNumber);
    ARRAY arraynew = new ARRAY(new ArrayDescriptor("APPS.JTF_NUMBER_TABLE", txn), txn, vNumberrespid);
    ARRAY array1 = new ARRAY(new ArrayDescriptor("APPS.JTF_VARCHAR2_TABLE_100", txn), txn, as);
    cs.setArray(1, array);
    cs.setArray(2, arraynew);
    cs.setArray(3, array1);
    cs.registerOutParameter(3, 2003, "JTF_VARCHAR2_TABLE_100");
    cs.execute();
    ARRAY error = null;
    error = (ARRAY)cs.getArray(2);
    if ((error != null) && (error.length() > 0))
    System.out.println(String.valueOf("Error is ").concat(String.valueOf(error.getArray())));
    String[] retError = new String[j];
    retError = (String[])error.getArray();
    System.out.println(String.valueOf("Error in saving data").concat(String.valueOf(retError[0])));
    cs.close();
    catch (Exception exception)
    throw new OAException("code blast", OAException.ERROR);
    Thanks,
    Sombit

  • How to highlight the repeated records in a BO crystal report?

    Hi ,
    How to highlight the repeated records in a BO crystal report?
    we want to highlight the rows for which account number is same.
    thanks
    sriram

    You don't even need to create a group.  Just sort the records on the fields that define "duplicate".  Then you can just use
    if {field} = PreviousValue({field}) then crYellow else crNoColor
    in the format's Background Color formula.  This will cause the background to be yellow on duplicates.  (If you need to check more than one field in order to determine duplicates, just insert
    and {field2} = PreviousValue({field2}
    and so on for each field that needs to be checked.
    HTH,
    Carl

  • How to avoid the duplicate values, I do not want the duplicate............

    i have one database table called "sms1" that table is updated every day or on daily basis it has the following fields in it:
    SQL> desc sms1;
    Name Null? Type
    MOBILE NUMBER
    RCSTCNATCNATCNATCNAWTHER VARCHAR2(39 CHAR)
    SNO NUMBER
    INDATE DATE
    From this table the is one column "RCSTCNATCNATCNATCNAWTHER VARCHAR2(39 CHAR)" . I am splitting it into different columns like :
    SQL> desc smssplit;
    Name Null? Type
    R VARCHAR2(2 CHAR)
    C VARCHAR2(2 CHAR)
    S VARCHAR2(1 CHAR)
    TC VARCHAR2(3 CHAR)
    NA VARCHAR2(3 CHAR)
    TC2 VARCHAR2(3 CHAR)
    NA2 VARCHAR2(3 CHAR)
    TC3 VARCHAR2(3 CHAR)
    NA3 VARCHAR2(3 CHAR)
    TC4 VARCHAR2(3 CHAR)
    NA4 VARCHAR2(3 CHAR)
    WTHER VARCHAR2(10 CHAR)
    SNO NUMBER
    INSERTDATA VARCHAR2(25 CHAR)
    Now I am written a procedure to insert the data from "Sms1" table to smssplit table...
    CREATE OR REPLACE PROCEDURE SPLITSMS
    AS
    BEGIN
    INSERT INTO scott.SMSSPLIT ( R,C,S,TC,NA,TC2,NA2,TC3,NA3,TC4,NA4,WTHER,SNO)
    SELECT SUBSTR(RCSTCNATCNATCNATCNAWTHER,1,2) R,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,3,2) C,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,5,1) S,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,6,3) TC,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,9,3) NA,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,12,3) TC2,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,15,3) NA2,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,18,3) TC3,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,21,3) NA3,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,24,3) TC4,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,27,3) NA4,
    SUBSTR(RCSTCNATCNATCNATCNAWTHER,30,10) WTHER, SNO
    FROM scott.SMS1 where SNO=(select MAX (sno) from SMS1);
    END;
    Now in order to update the second table with data from first table on regular basis I have written a job scheduler and I am using oracle 9.0. version...
    DECLARE
    X NUMBER;
    JobNumber NUMBER;
    BEGIN
    SYS.DBMS_JOB.SUBMIT
    job => X
    ,what => 'scott.SPLITSMS;'
    ,next_date => SYSDATE+1/1440
    ,interval => 'SYSDATE+1/1440 '
    ,no_parse => FALSE
    :JobNumber := to_char(X);
    END;
    Now this job scheduler is working properly and updating the data for every one minute but it is taking or updating the duplicate values also ..like example:
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:49:16
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:49:16
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:50:17
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:50:17
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:51:19
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:51:19
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:52:20
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:52:20
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:53:22
    R C S TC NA TC2 NA2 TC3 NA3 TC4 NA4 WTHER SNO
    INSERTDATA
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:53:22
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:54:45
    33 35 2 123 456 789 543 241 643 243 135 RRRRRR 55
    06-SEP-2012 03:54:45
    Now I do not want the duplicate values to be updated ...and want them to ignore them.....
    please I need a help on this query........How to avoid the duplicate values............

    Look at the posts closely:might not be needed if formatted ;)
    create or replace procedure splitsms as
    begin
      insert into scott.smssplit (r,c,s,tc,na,tc2,na2,tc3,na3,tc4,na4,wther,sno)
      select substr(rcstcnatcnatcnatcnawther,1,2) r,
             substr(rcstcnatcnatcnatcnawther,3,2) c,
             substr(rcstcnatcnatcnatcnawther,5,1) s,
             substr(rcstcnatcnatcnatcnawther,6,3) tc,
             substr(rcstcnatcnatcnatcnawther,9,3) na,
             substr(rcstcnatcnatcnatcnawther,12,3) tc2,
             substr(rcstcnatcnatcnatcnawther,15,3) na2,
             substr(rcstcnatcnatcnatcnawther,18,3) tc3,
             substr(rcstcnatcnatcnatcnawther,21,3) na3,
             substr(rcstcnatcnatcnatcnawther,24,3) tc4,
             substr(rcstcnatcnatcnatcnawther,27,3) na4,
             substr(rcstcnatcnatcnatcnawther,30,10) wther,
             sno
        from scott.sms1 a
       where sno = (select max(sno)
                      from sms1
                     where sno != a.sno
                   ); ---------------> added where clause with table alias.
    end;Regards
    Etbin

  • How to delete the duplicate data  from PSA Table

    Dear All,
    How to delete the duplicate data  from PSA Table, I have the purchase cube and I am getting the data from Item data source.
    In PSA table, I found the some cancellation records for that particular records quantity  would be negative for the same record value would be positive.
    Due to this reason the quantity is updated to target but the values would summarized and got  the summarized value  of all normal and cancellation .
    Please let me know the solution how to delete the data while updating to the target.
    Thanks
    Regards,
    Sai

    Hi,
    in deleting the records in PSA table difficult and how many you will the delete.
    you can achieve the different ways.
    1. creating the DSO maintain the some key fields it will overwrite the based on key fields.
    2. you can write the ABAP logic deleting the duplicate records at info package level check with the your ABAPer.
    3.you can restrict the cancellation records at query level.
    Thanks,
    Phani.

  • How to delete the duplicate requests in a cube after compression.

    Hi experts,
        1. How to delete the duplicate requests in a cube after compression.?
        2. How to show a charaterstics and a keyfigure side by side in a bex query output?
    Regards,
    Nishuv.

    Hi,
    You cannot delete the request as its compressed as all the data would have been moved to E table ..
    If you have the double records you may use the selective deletion .
    Check this thread ..
    How to delete duplicate data from compressed requests?
    Regards,
    shikha

  • How to handle the bad record while using bulk collect with limit.

    Hi
    How to handle the Bad record as part of the insertion/updation to avoid the transaction.
    Example:
    I am inserting into table with LIMIT of 1000 records and i've got error at 588th record.
    i want to commit the transaction with 588 inserted record in table and log the error into
    error logging table then i've to continue with transaction with 560th record.
    Can anyone suggest me in this case.
    Regards,
    yuva

    >
    How to handle the Bad record as part of the insertion/updation to avoid the transaction.
    >
    Use the SAVE EXCEPTIONS clause of the FORALL if you are doing bulk inserts.
    See SAVE EXCEPTIONS in the PL/SQL Language doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/tuning.htm
    And then see Example 12-9 Bulk Operation that continues despite exceptions
    >
    Example 12-9 Bulk Operation that Continues Despite Exceptions
    -- Temporary table for this example:
    CREATE TABLE emp_temp AS SELECT * FROM employees;
    DECLARE
    TYPE empid_tab IS TABLE OF employees.employee_id%TYPE;
    emp_sr empid_tab;
    -- Exception handler for ORA-24381:
    errors NUMBER;
    dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT(dml_errors, -24381);
    BEGIN
    SELECT employee_id
    BULK COLLECT INTO emp_sr FROM emp_temp
    WHERE hire_date < '30-DEC-94';
    -- Add '_SR' to job_id of most senior employees:
    FORALL i IN emp_sr.FIRST..emp_sr.LAST SAVE EXCEPTIONS
    UPDATE emp_temp SET job_id = job_id || '_SR'
    WHERE emp_sr(i) = emp_temp.employee_id;
    -- If errors occurred during FORALL SAVE EXCEPTIONS,
    -- a single exception is raised when the statement completes.
    EXCEPTION
    -- Figure out what failed and why
    WHEN dml_errors THEN
    errors := SQL%BULK_EXCEPTIONS.COUNT;
    DBMS_OUTPUT.PUT_LINE
    ('Number of statements that failed: ' || errors);
    FOR i IN 1..errors LOOP
    DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
    'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
    DBMS_OUTPUT.PUT_LINE('Error message is ' ||
    SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
    END LOOP;
    END;
    DROP TABLE emp_temp;

Maybe you are looking for