How to avoid duplicate data while inserting from sample.dat file to table

Hi Guys,
We have issue with duplicate data in flat file while loading data from sample.dat file to table. How to avoid duplicate data in control file.
Can any one help me on this.
Thanks in advance!
Regards,
LKR

No, a control file will not remove duplicate data.
You would be better to use an external table and then remove duplicate data using SQL as you query the data to insert it to your destination table.

Similar Messages

  • Avoiding duplicate records while inserting into the table

    Hi
    I tried the following insert statement , where i want to avoid the duplicate records while inserting itself
    but giving me the errror like invalid identifier, though the column exists in the table
    Please let me know Where i'm doing the mistake.
    INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
       SELECT 100,
              sk.obj_id,
              sk.key_txt,
              sk.obj_typ,
              sysdate,
              FROM S_KEY sk
        WHERE     sk.obj_typ = 'AY'
              AND SYSDATE BETWEEN sk.start_date AND sk.end_date
              AND sk.obj_id IN (100170,1001054)
               and   not exists  (select 1
                                                                   FROM t_map tm1 where tm1.O_ID=tm.o_id
                                                                        and tm1.sn_id=tm.sn_id
                                                                        and tm1.txt=tm.txt
                                                                        and tm1.typ=tm.typ
                                                                        and tm1.sn_time=tm.sn_time )

    Then
    you have to join the table with alias tml where is that ?do you want like this?
    INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
       SELECT 100,
              sk.obj_id,
              sk.key_txt,
              sk.obj_typ,
              sysdate,
              FROM S_KEY sk
        WHERE     sk.obj_typ = 'AY'
              AND SYSDATE BETWEEN sk.start_date AND sk.end_date
              AND sk.obj_id IN (100170,1001054)
               and   not exists  (select 1
                                                                   FROM t_map tm where sk.obj_ID=tm.o_id
                                                                        and 100=tm.sn_id
                                                                        and sk.key_txt=tm.txt
                                                                        and sk.obj_typ=tm.typ
                                                                        and sysdate=tm.sn_time )

  • How to avoid Duplicate Records  while joining two tables

    Hi,
    I am trying to join three tables, basically two tables are same one is like history table, so I wrote a query like
    select
    e.id,
    e.seqNo,
    e.name,
    d.resDate,
    d.details
    from employees e,
    ((select * from dept)union(select * from dept_hist)) d
    join on d.id=e.id and e.seqno=d.seqno
    but this returing duplicate records.
    Could anyone please tell me how to avoid duplicate records of this query.

    Actually it is like if the record is processed it will be moved to hist table, so both table will not have same records and I need the record from both the tables so i have done the union of both the tables, so d will have the union of both records.
    But I am getting duplicate records if even I am distinct.

  • How to avoid duplicates values from alvgird see below code

    how to avoid duplicates values from alvgird see below code
    in below query docno no is repeated again and again
    how i can avoid duplication in this query.
    select * into corresponding fields of table itab
             from  J_1IEXCHDR
                     inner join  J_1IEXCDTL
                        on  J_1IEXCDTLlifnr =  J_1IEXCHDRlifnr
                     where  J_1IEXCHDr~status = 'P'.

    Hi Laxman,
    after that select statement
    select * into corresponding fields of table itab
    from J_1IEXCHDR
    inner join J_1IEXCDTL
    on J_1IEXCDTLlifnr = J_1IEXCHDRlifnr
    where J_1IEXCHDr~status = 'P'.
    <b>if sy-subrc = 0.
    delete adjucent duplicates from itab comparing <field name of itab internal table>
    endif.</b>
    this will delete your duplicate entries.once you done with this call the alv FM.
    <b>  call function 'REUSE_ALV_GRID_DISPLAY'</b>
    exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'IT_USER_COMMAND'
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       i_grid_title                      = 'Purchase Order Details'
      I_GRID_SETTINGS                   = I_GRID_SETTINGS
       is_layout                         = wa_layout
       it_fieldcat                       = it_fieldcat
      IT_EXCLUDING                      = IT_EXCLUDING
      IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
       it_sort                           = it_sort
      IT_FILTER                         = IT_FILTER
      IS_SEL_HIDE                       = IS_SEL_HIDE
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        = IS_VARIANT
       it_events                         = it_event
      IT_EVENT_EXIT                     = IT_EVENT_EXIT
      IS_PRINT                          = IS_PRINT
      IS_REPREP_ID                      = IS_REPREP_ID
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
      IT_HYPERLINK                      = IT_HYPERLINK
      IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
      IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
      IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
      ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
        tables
    <b>      t_outtab                          = ITAB</b>
    exceptions
       program_error                     = 1
       others                            = 2
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    Thanks
    Vikranth Khimavath

  • How to avoid mutating error when insert or update record

    Hi ,
    I have one transaction table which is having some detail record under one transaction number, after the one transaction number is over by insert or update, i
    want to check the total amounts of one flag should be matched on same table if it is not then give error message. But i am getting mutating error on insert or update event trigger on statement level trigger on above table.
    Is there any other way to avoid mutating error to solve the above problem or some temp table concepts to be used. help me its urgent.
    Thanks in advance,
    Sachin Khaladkar
    Pune

    Sachin, here's as short of an example as I could come up with on the fly. The sample data is ficticious and for example only.
    Let's say I need to keep a table of items by category and my business rule states that the items in the table within each category must total to 100% at all times. So I want to insert rows and then make sure any category added sums to 100% or I will rollback the transation. I can't sum the rows in a row-level trigger because I'd have to query the table and it is mutating (in the middle of being changed by a transaction). Even if I could query it while it is mutating, there may be multiple rows in a category with not all yet inserted, so checking the sum after each row is not useful.
    So here I will create;
    1. the item table
    2. a package to hold my record collection (associative array) for the trigger code (the category is used as a key to the array; if I insert 3 rows for a given category, I only need to sum that category once, right?
    3. a before statement trigger to initialize the record collection (since package variables hang around for the entire database session, I need to clear the array before the start of every DML (INSERT in this case) statement against the item table)
    4. a before row trigger to collect categories being inserted
    5. an after statement trigger to validate my business rule
    I then insert some sample data so you can see how it works. Let me know if you have any questions about this.
    SQL> CREATE TABLE item_t
      2   (category  NUMBER(2)   NOT NULL
      3   ,item_code VARCHAR2(2) NOT NULL
      4   ,pct       NUMBER(3,2) NOT NULL);
    Table created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE trg_pkg IS
      2    TYPE t_item_typ IS TABLE OF item_t.category%TYPE
      3      INDEX BY PLS_INTEGER;
      4    t_item       t_item_typ;
      5    t_empty_item t_item_typ;
      6  END trg_pkg;
      7  /
    Package created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_bs_trg
      2    BEFORE INSERT
      3    ON item_t
      4  BEGIN
      5    DBMS_OUTPUT.put_line('Initializing...');
      6    trg_pkg.t_item := trg_pkg.t_empty_item;
      7  END item_bs_trg;
      8  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_br_trg
      2    BEFORE INSERT
      3    ON item_t
      4    FOR EACH ROW
      5  BEGIN
      6    trg_pkg.t_item(:NEW.category) := :NEW.category;
      7    DBMS_OUTPUT.put_line('Inserted Item for Category: '||:NEW.category);
      8  END item_br_trg;
      9  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER item_as_trg
      2    AFTER INSERT
      3    ON item_t
      4  DECLARE
      5    CURSOR c_item (cp_category item_t.category%TYPE) IS
      6      SELECT SUM(pct) pct
      7        FROM item_t
      8       WHERE category = cp_category;
      9  BEGIN
    10    DBMS_OUTPUT.put_line('Verifying...');
    11    FOR i IN trg_pkg.t_item.FIRST..trg_pkg.t_item.LAST LOOP
    12      DBMS_OUTPUT.put_line('Checking Category: '||trg_pkg.t_item(i));
    13      FOR rec IN c_item(trg_pkg.t_item(i)) LOOP
    14        IF rec.pct != 1 THEN
    15          RAISE_APPLICATION_ERROR(-20001,'Category '||trg_pkg.t_item(i)||' total = '||rec.pct);
    16        END IF;
    17      END LOOP;
    18    END LOOP;
    19  END item_as_trg;
    20  /
    Trigger created.
    SQL> SHOW ERRORS;
    No errors.
    SQL> INSERT INTO item_t
      2    SELECT 1, 'AA', .3 FROM DUAL
      3    UNION ALL
      4    SELECT 2, 'AB', .6 FROM DUAL
      5    UNION ALL
      6    SELECT 1, 'AC', .2 FROM DUAL
      7    UNION ALL
      8    SELECT 3, 'AA',  1 FROM DUAL
      9    UNION ALL
    10    SELECT 1, 'AA', .5 FROM DUAL
    11    UNION ALL
    12    SELECT 2, 'AB', .4 FROM DUAL;
    Initializing...
    Inserted Item for Category: 1
    Inserted Item for Category: 2
    Inserted Item for Category: 1
    Inserted Item for Category: 3
    Inserted Item for Category: 1
    Inserted Item for Category: 2
    Verifying...
    Checking Category: 1
    Checking Category: 2
    Checking Category: 3
    6 rows created.
    SQL>
    SQL> SELECT * FROM item_t ORDER BY category, item_code, pct;
      CATEGORY IT        PCT
             1 AA         .3
             1 AA         .5
             1 AC         .2
             2 AB         .4
             2 AB         .6
             3 AA          1
    6 rows selected.
    SQL>
    SQL> INSERT INTO item_t
      2    SELECT 4, 'AB', .5 FROM DUAL
      3    UNION ALL
      4    SELECT 5, 'AC', .2 FROM DUAL
      5    UNION ALL
      6    SELECT 5, 'AA', .5 FROM DUAL
      7    UNION ALL
      8    SELECT 4, 'AB', .5 FROM DUAL
      9    UNION ALL
    10    SELECT 4, 'AC', .4 FROM DUAL;
    Initializing...
    Inserted Item for Category: 4
    Inserted Item for Category: 5
    Inserted Item for Category: 5
    Inserted Item for Category: 4
    Inserted Item for Category: 4
    Verifying...
    Checking Category: 4
    INSERT INTO item_t
    ERROR at line 1:
    ORA-20001: Category 4 total = 1.4
    ORA-06512: at "PNOSKO.ITEM_AS_TRG", line 12
    ORA-04088: error during execution of trigger 'PNOSKO.ITEM_AS_TRG'
    SQL>
    SQL> SELECT * FROM item_t ORDER BY category, item_code, pct;
      CATEGORY IT        PCT
             1 AA         .3
             1 AA         .5
             1 AC         .2
             2 AB         .4
             2 AB         .6
             3 AA          1
    6 rows selected.
    SQL>

  • How to avoid authorization checks while debugging

    Hi,
    Can anyone let me to know how to avoid authorization checks while debugging
    for a standard transaction?
    -B S B

    Hello BSB,
    To start the debug put /hs will start the system debug.
    Then place the break points aat STATEMENT -- MESSAGE and F8
    So now the system will stop at the point where it throwing the error message change the value of SY-SUBRC to 0 from 4.
    Regards,
    Vasanth

  • How to avoid duplicate posting of noted items for advance payment requests?

    How to avoid duplicate posting of noted items for advace payments request?

    Puttasiddappa,
    In the PS module, we allow the deletion of a component pruchase requisition allthough a purchase order exists. The system will send message CN707 "<i>A purchase order already exists for purchase requisition &</i>" as an Iinformation message by design to allow flexible project management.
    If you, however, desire the message CN707 to be of type E you have to
    modify the standard coding. Doing so, using SE91, you can invoke the
    where-used-list of message 707 in message class CN, and to change the
      i707(cn)
    to
      e707(cn)
    where desired.
    Also, user exit CNEX0039 provides the possibility to reject the
    deletion of a component according to customers needs e. g. you may
    check here whether a purchase order exists and reject the deletion.
    Hope this helps!
    Best regards
    Martina Modolell

  • How to plot waterfall graph in vb6 from offline data

    How to plot waterfall graph in vb6 from offline data?The data load from SQL Server Database.Thanks.

    asrol,
    If you look at the Plot Styles example in the folder I mentioned in the previous post there is a section of code there that you might want to refer to in order to recreate your data.
    '=============================================================================
    ' Plot Curve Button Handler
    '=============================================================================
    Private Sub PlotCurve_Click()
        ' Create curve data
        Dim x(40)
        Dim y(40)
        Dim z(40)
        For i = 0 To 40
            x(i) = Sin(i / 3#)
            y(i) = Cos(i / 3#)
            z(i) = i
        Next i
    In this example they create 3 arrays to represent the three dimensions of the array. For your case if you were to plug your data into two of the array (axes) that would give you the data for the channels, then you can simply input a constant for the third array it would produce a single line of your data as shown in your example GIF.  You can then repeat this process for each set of data, with a new constant value for that third axis, and it should manually create a graph that will look something like you desire.
    John B.
    Applications Engineer
    National Instruments

  • How to avoid invoice split due to different billing dates?

    Hi All,
    How to avoid invoice split due to different billing dates during executing VF04 transction?
    I want to club 30 delivery documents with different billing due dates in one invoice.
    I am using VF04 tr for the same. However, here i cannot control the invoice split based on diff billing due dates.
    If the same thing is tried via VF01 , it allows only 14 del dcouments at a time.
    Can u suggest  abetter technique to do the same?
    Regards,
    Niketan

    I think I already explained you in a similar post to use VF04 setting the billing date as default:
    menu: settings->default data. Place  the date in field Billing Date.
    pls. reward if helpfull
    Roberto

  • How to bulk import data into CQ5 from MySQL and file system

    Is there an easy way to bulk import data into CQ5 from MySQL and file system?  Some of the files are ~50MB each (instrument files).  There are a total of ~1,500 records spread over about 5 tables.
    Thanks

    What problem are you having writing it to a file?
    You can't use FORALL to write the data out to a file, you can only loop through the entries in the collection 1 by 1 and write them out to the file like that.
    FORALL can only be used for SQL statements.

  • How to renormalize number of flows in Netflow Sampled data

    Hi,
    I am working on extrapolation(renormalization) of bytes/packets/flows from randomly sampled (1 out of N packets) collected data. I believe bytes/packets can be renormalized by multiplying bytes/packets value in exported flow record by N.
    Now, I am trying to extrapolate number of flows. So far i have not got any information on it. Do you people have any idea on how flows can be renormalized from sampled data ?
    Well, at the same time i have some doubts regarding this concept altogether -
    1. In packet sampling, we do not know how many flows got dropped. Even router cache will not have entries for dropped flows
    2. In flow sampling, router cache will maintain entries of all the flows and there may be some way by which one can know how many actual flows were there. But again there is no way to know values of individual attributes in missed flows like srcip/dstip/srcport/dstport etc.(though they are there in flow cache)
    3. In case of sampling (1 out of N packets), we anyway multiply #packets and #bytes with N to arrive at estimate for total packets and bytes. When we multiply by N, it means we have taken into account all those packets as well which were NOT sampled. So, it means all the packets which flowed between source and destination have been accounted for. Then there are no missed flows, isn't it ? And if there do exist some missed flows then multiplication by N to extrapolate number of packets/bytes is not correct.
    4. What is the use of count of flows anyways. Number of flows may vary depending upon the configuration such as active timeout etc. So, it does not provide any information about the actual flow between source and destination unlike number of packets and bytes.
    Please share your thoughts.
    Thanks,
    Deepak

    The simplest way is to call GetTableCellRangeValues with VAL_ENTIRE_TABLE as the range, next summing array elements.
    But I don't understand your comment on checksum, so this may not be the more correct method for your actual needs: can you explain what do you mean?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How can i use BAPI to insert a few records  into standard table

    Can anyone help me with how can i use BAPI to insert some records into a standard table from an internal table?

    Hi,
    First of All try to Explain your Question first.
    This is a general question without mentioning the Table you want to Update.
    Please give the details before posting a question  so it will help people to understand your Problem.
    Regards
    Sandipan

  • How do i remove the exif metadata from my jpg file produced with a digital camera photo?

    How do i remove the exif metadata from my jpg file produced with a digital camera photo?

    The excellent and free utility Irfanview has the option to remove the EXIF data.
    Simply open and the file and do a Save, or Save As with the original name.
    Surprisingly, the default is to not keep the original EXIF data.

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • Web report data provider change from Master data table to InfoCube

    hi Experts,
    I have created one report on top of multiprovider but in the selection screen when i check the values for a variable I came to know that data is coming from master data table and not from data provider(InfoCube).Can any one help to change the data selection from master data table to data provider(InfoCube) and i am sure that there is no ODS involved in the multiprovider.
    Thanks in advance
    With Regards,
    Bala

    Hello,
    If u are using Analyser then just put a Analysis Grid on the output of the query(should cover all the rows and column) , click on the grid and put the dataprovider. and do auto fit.
    Rohit

Maybe you are looking for

  • Merge of planned orders from the same product

    Hi Experts, We have some lines where we process materials with different properties so setup time/costs between ones and anothers are very important. If we run the PPDS Optimizer or scheduling based on setup groups for a period of 2 weeks then depend

  • What's your external drive for iTunes storage?

    I have a portable SmartDisc 60gig FireLight . It's firewire powered so it goes to sleep with the eMac . It works great but I need something bigger and I guess the desktop drives that cost less are AC powered ? I didn't like the Maxtor OneTouch III an

  • Folders of Full Cds showing up in one Unknown folder Help

    Ive ripped my Cds into WMA 28 bit files but then i ripped them and put them into a folder on my PC and then move them to Zen V Plus the go into unfolder and there no longer in different folders just 30 songs in unknown folder. This doesnt happen with

  • Internal Order for prepaid events

    While posting internal order for prepaid events, the system is forcing to enter Investment Profile. That should be the case if it is an investment measure ut this internal order is for recording short term events that get prepaid. How to make this  f

  • What to do with all the disks left on my computer after application install

    I have been using the Mac for a year now (very happy overall), but am still a bit confused by what exactly the whole disk icon left over after an install is about. And then what about the .dmg and .pkg scene? After I install a new application I have