Deletion based on data.

Respected sir,
I want to know about how to delete the key based on the key and data value.
Eg:-
Key = 100 data = aneesh
Key = 100 data = nobu
Key = 200 data = vava.
i want to delete key = 100 and data = aneesh.
please give me the answer of the above.
Regards ,
Aneesh Kumar A.R

Hello,
Please take a look at the "Getting Records Using the Cursor"
section of the Using Cursors documentation at:
http://www.oracle.com/technology/documentation/berkeley-db/db/gsg/C/Positioning.html
See the discussion on searching based on both the key and the data.
Thanks,
Sandra

Similar Messages

  • Deleting records based on date with timestamp

    Hi there,
    In continuation from my earlier Query. Multiple reccord have inadvertantly been inserted in the LOAN_TXN table. I want to delete all the records, except one, based on date with timestamp.
    CREATE TABLE LOAN_TXN
    TXN_DATE                     DATE,
    BALANCE          NUMBER(10,2),
    CODE          VARCHAR2(1),
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '02/15/2010 11:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 250000, 'D');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2010 11:59:59 AM', 'MM/DD/YYYY HH:MI:SS AM'), 250000, 'B');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '05/14/2010 11:25:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 500000, 'D');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '06/30/2010 12:15:00 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '08/02/2010 10:45:26 AM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '09/08/2010 02:10:17 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '10/27/2010 04:25:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '11/09/2010 10:15:55 AM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '12/29/2010 03:10:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '01/12/2011 01:11:15 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '02/11/2011 12:11:48 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:59:59 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:59:59 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:59:59 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
    INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:59:59 AM', 'MM/DD/YYYY HH:MI:SS AM'), 460000, 'B');I want to delete mutiple records, except one, with code 'R' and TXN_DATE = '03/31/2011 11:59:59 PM' How do I do that ?

    user3308033 wrote:
    I think your query would delete all the duplicate records. Keeping one, I just want to delete mutiple records with timestamp : 11:59:59.
    DELETE FROM loan_txn
    WHERE rowid != (
                     SELECT  MIN(rowid)
                       FROM  loan_txn
                       WHERE txn_date = TO_DATE('03/31/2011 11:59:59 PM','MM/DD/YYYY HH:MI:SS AM')
                         AND code = 'R'
        AND txn_date = TO_DATE('03/31/2011 11:59:59 PM','MM/DD/YYYY HH:MI:SS AM')
        AND code = 'R'
    /SY.

  • 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.

  • Selecting material based on date

    Hello Experts,
    I have requirement where i want to give material and date.
    i have to select materia, condition record number based on date.
    In database table field is stored like material , validity from date and validity to date.
    Same material number is there but validity date and condtion record number is different.
    Matno        from date                 to date                      Condition record no
    1234       01.01.2009                31.12.2009                       23456
    1234       01.01.2008                31.12.2008                       12367
    if user enter date 12.09.2009 it should fetch me first record. ( because date is between 01.01.2009 to 31.12.2009)
    if user enter date 20.08.2008 it should fetch me first record. ( because date is between 01.01.2008 to 31.12.2008)
    field for input date is fkdate.
    So how i have to query in select statement to get this requirement.
    Thanks in advance.
    Best regards,
    Sai

    select * "or the fields you need
           from abcd
            into table itab
            where matnr in s_matnr "if you have it in sel screen or remove it..
                 and dat_fr GE p_fkdat
                 and dat_to LE p_fkdat.
    but if the dates are not keys...
    better not use them in select...
    delete the unnecessary items after the select using DELETE ITAB where...

  • How to group data based on date

    In my program the internal table is returning several values based on date.
    for example for the first pernr in the image below  there are four records. i need to delete the first record which is between the dates 20 and 30 .
    and also i need to get the difference between the dates as the record 23 and 28  i need to get separate dates as 24, 25..28.

    I am not sure if I understood your question correctly.
    From what I have understood, you can use the following logic.
    This logic will move all the records from lt_fields2 to another table lt_fields1 with begda between 20 and 30 of any month, except for the first record. It will also move records for every date between begda and endda of each record.
    You can alter the logic based on your exact requirement.
    declare another table lt_fields1 like lt_fields2.
    data del_flag.
    data prev_month(2) type c.
    sort lt_fields by pernr begda.
    clear del_flag.
    loop at lt_fields2 into wa_fields where begda+6(2) GE 20.
    * Delete the first record having date greater than 20 in a month for each pernr.
       at new pernr.
            clear del_flag.
       endat.
       if begda+4(2) NE prev_month.
           clear del_flag.
      endif.         
        if del_flag is initial. 
            del_flag = 'X'.
            continue.  " This record will not be moved to the final internal table.
       endif.
    * Add records for each date between begda and endda.
       append wa_fields to lt_fields1.
       prev_month = begda+4(2)
       while wa_fields-begda LT wa_fields-endda.
             wa_fields-begda = wa_fields-begda+1.
             append wa_fields to lt_fields1.
       endwhile.
    endloop.

  • Selective Deletion of Infocube data

    BW experts,
    I have a scenario where in "rough" data already stored in an InfoCube will be replaced by a more "intelligent" data from another source. The deletion/replacement of data should happen without manual intervention (cause flat file data files arrive at a schedule time and should be loaded "automatically"into the cube) What are my options here? I currently know that it is possible to delete infocube contents using function module 'RSDRD_SEL_DELETION' (perhaps do it in the Update Rule).
    1) Is there another way (more "SAP Standard" or more "intelligent")?  I need to delete based on characteristics  that can be found in the file (e.g. the file has data for 0MATERIAL, 0CALWEEK).
    2) What are the "watch outs" for using function module 'RSDRD_SEL_DELETION'?
    Please advise.
    Thank you very much.

    Hello Emmanuel,
       In ABAP programe Just used the Infocube Name and the selection condition on what basis you want to delete.
    See Below the code.
    *add the fiscper selection in L_THX_SEL table for seletion of data
    CLEAR L_SX_SEL.
      L_SX_SEL-IOBJNM = '0FISCPER'.
        CLEAR L_S_RANGE.
        L_S_RANGE-SIGN = 'I'.
        L_S_RANGE-OPTION = 'EQ'.
        L_S_RANGE-LOW = TFISCPER.  "yr data.
    *--this is imortant otherwise data wil not delete
        L_S_RANGE-KEYFL = RS_C_TRUE.
        APPEND L_S_RANGE TO L_SX_SEL-T_RANGE.
      INSERT L_SX_SEL INTO TABLE L_THX_SEL.
    **get the selection for company
      CLEAR L_SX_SEL.
      L_SX_SEL-IOBJNM = '0COMPANY'.
        CLEAR L_S_RANGE.
        L_S_RANGE-SIGN = 'I'.
        L_S_RANGE-OPTION = 'EQ'.
        L_S_RANGE-LOW = VARIANT.
    *--this is imortant otherwise data wil not delete
        L_S_RANGE-KEYFL = RS_C_TRUE.
        APPEND L_S_RANGE TO L_SX_SEL-T_RANGE.
      INSERT L_SX_SEL INTO TABLE L_THX_SEL.
    *function module for selective deletion..
    CALL FUNCTION 'RSDRD_SEL_DELETION'
      EXPORTING
        I_DATATARGET              = 'IFIBIV'
        I_THX_SEL                 =  L_THX_SEL
      I_DEL_ACTIV               = RS_C_TRUE
      I_DEL_UPDATE              = RS_C_FALSE
      I_DEL_CHANGE              = RS_C_FALSE
      I_AUTHORITY_CHECK         = RS_C_TRUE
      I_MODE                    = RSDRD_C_MODE-CHOOSE
      I_THRESHOLD               = '0.1'
      I_PARALLEL_DEGREE         = 1
      I_NO_LOGGING              = RS_C_FALSE
      I_NO_COMMIT               = RS_C_FALSE
      I_NO_ENQUEUE              = RS_C_FALSE
      I_SHOW_REPORT             = RS_C_FALSE
      I_TRANSACTIONAL_ODS       = RS_C_FALSE
      CHANGING
        C_T_MSG                   =  L_T_MSG
    EXCEPTIONS
      X_MESSAGE                 = 1
      INHERITED_ERROR           = 2
      INVALID_TYPE              = 3
      OTHERS                    = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Hope This will help.
    In Start Routine there is no disadvantage to delete the data from data package.
    But it depened on the scenario and requirement.
    Regards
    Gopal

  • Alert based on date

    I have a list of SSL certificates and their expiration dates.  I created a column that calculates the date 45 days before the expiration and then a view that only shows those items where the (expiration - 45) > Today.
    I then set an alert for any changes to items in that view.  However, I don't get an alert for items that pop into the view...I guess because the item itself did not change.  Is there a way to send an alert based on date? 
    My SharePoint enviroment is locked down so I can't create custom workflows or connect via Designer.

    Thanks for the idea.  I don't guess it will work as the only option I have when enabling the expiration feature is to delete the item. 
    So far, the best idea I have is a weekly calendar reminder to go look at the view for expiring certificates.
    Before setting the policy you need to go to workflow settings and add a disposition workflow to the list so it is available as an option when you Enable Expiration in the Information Policy Settings.
    After you set the expiration policy to start your workflow, set up an alert on the workflow tasks list you associated with the disposition workflow.
    - Xenox G.

  • Help please: Selective Deletion of Infocube data (Sales)

    Dear Experts
    Am working on a BW 3.5 server
    I have been referring to the below SDN posting
    <u>Selective Deletion of Infocube data</u>
    My scenario is like this..
    My Sales data infocube has multiple records with the
    same Delivery number and Bill of Lading number
    (same material number also).
    Some of these records are having "Created" status
    others are with "Cancelled" status.
    Requirement is to retain latest record based on Billing date
    after deleting previous records
    having same Delivery number and Bill of Lading number.
    Kindly advice a best practice solution.
    warm Regards,
    AbyJ
    ============

    Hi,
    I think selective deletion won't be the right solution to your problem.
    I would suggest to build up a second cube as a 1:1 copy of your sales cube.
    Build a transformation or update rule from your old to your new cube. In the startroutine you can now easily retain latest record based on Billing date
    after deleting previous records having same Delivery number and Bill of Lading number by sorting your data package according to this fields. After you have checked it in the new cube, you can either leave that and build the reporting on this cube if possible or in a second step you have to delete data in your old cube and then reload your new cube completely in your old cube. Build a transformation or update rule, easy 1:1 relations and reload data.
    An issue for this approach can be the number of records in your sales cube.
    Regards,
    Juergen

  • Is it possible to get the updated table records based on date & time.

    Is it possible to get the updated table records based on date & time in oracle.
    Thanks in advance.

    no, actually i am asking update records using 'UPDATE
    or DELETE' statement, but not insert statement.
    Is it possible?
    I think we can do using trigger on table, but problem
    is if i am having 20 tables means i have to write 20
    trigger. i don't want like this.Of course it's still possible, typically you'll find applications with a column LAST_UPDATE, probably a LAST_UPDATED_BY and so on column. You don't say what your business need is, if you just want a one of query of updates to particular records and have a recent version of Oracle, then flashback query may well help, if you want to record update timestamps you either have to modify the table, or write some code to store your updates in an audit table somewhere.
    Niall Litchfield
    http://www.orawin.info/

  • Deletion of master data for 0CS_ORDER

    Hello Friends,
    I have a requirement to enhance an IOBJ 0CS_ORDER with Order status values(2 new statues are added). I have done the enhancement part to the extractor in the source system side. Now after replication in BW, to add 2 new IOBJs in CS_ORDER, I need to delete the master data.
    When I try to do this, I get the msg that some master data could not be deleted.
    This is fine as we have transaction data loaded for large no. of objects which has 0CS_ORDER.
    In dev, I have deleted the master data using SE14 for tables P, S , X, T.
    My concern is in Production, I have huge volume of transaction data. To transport the changes, I need to delete master data. But this would require deletion of Transaction data from all IP where CS_ORDER is used.
    If I do so using SE14, and tranport the changes and later load MD to CS_ORDER. Will this cause INCONSISTENCIES?
    What can be other possible ways??
    Please share your opinions.
    Many Thanks,
    VA
    Edited by: Vishwa  Anand on Sep 2, 2010 5:36 PM

    Definitely Yes.
    It will damage all the SID connections earlier which this master data had with the other objects likes transactiona objects (ODS, CUBES etc). Even You can not access the data from the cube or ODS where the navigational attributes are flagged for reading.
    So do not use SE14 for deletion of MD. This is very specific to use.
    You can delete the Master data as long as its not been used in other targets so that you can refill it easily and also there wont be any inconsistencies..
    Hope this is clear for you..

  • Deletion of master data with / without SID

    Hi Experts,
    Client have requested for master data clean up.
    Requirement:
    "Several masterdata tables in Production system contain wrong entries. These entries should be cleaned up. The attached Excel contains the keys of the entries to be deleted"
    Steps to be taken:
    1. emptied/deleted content of all the cube.
    2. delete data from master data
    Help required:
    What will be impact of deleting master data with SID when DSO data is not deleted.
    What if i choose without SID option for deletiing master data
    Regards
    Suresh Kumar

    Hi Suresh,
    Deleting master data is one critical job and ned to be very care ful.
    First try to find out the where used list of that particular IO. delete data from all the CUBEs and DSOs. i don't think without deleting the transaction data from all the objects that you see from where used list, you will be able to delete the maste data.
    System doesn't allow you, it will say "Not all selected data is deleted" Some message of this sort when you try deleting the master data.
    If you are deleting the TD and  master data, why do you need the SID to be spared, delete them too. next time you load the correct master data. the SIDs are again generated.
    Go thru the below thread, this gives you lot if info on MD deletion.
    [Re: SID Tables]

  • Process Chain - How to make decision based on data in PSA and execute DTP

    Need to create process in Process Chain, which will execute the DTP based on data in PSA.
    Say we have two DSO A & B, both getting data from same datasource.
    In process chain, we need to read data in one of the date field in PSA and make a decision, which DTP to get execute in process chain.
    Say if date field contains year = 2000, than load to DSO A, if year is 2001, load data to DSO B.
    Suggest the solution. ...

    Hi,
    Tyr this steps.
    1) Develop ABAP process types
    ABAP report to read PSA data using function module
    Trigger events based on year
                           event1 -> for even year data
                           event2 -> for add year data
    2) Develop local process chains for each DTPs and schdule it with events mentioned above.
    Do reply with comments.

  • Batch Determination based on date of consig recieve

    Hi,
    I am getting problem when i am trying to do manual batch determination in the outbound delivery.
    I have created a record in VCH1 based on customer/Material/Plant. In this i have maintained a sort rule also. what characteristaics i must use to make my batch determination based on customer consignment recieving date?
    If i go in MSC3n with Material, Plant and batch data then in the screen ( table MCHA, MCH1) onlt data available is for ERSDA, LAEDA  and LWEDT.
    In delivery when i click on batch determination button. my Sort rule is not automatically determined. So i have to maunally entered my soirt rule but at the same time my qty proposal in the same screen is 1 which is nothing but
    FORM CHMVS_001.
      DATA: lv_line TYPE kondh-chasp VALUE '1'.
      LOOP AT disqty.
        CHECK lv_line <= no_of_split.
        IF QUAN_TO_DIS > 0.
          IF DISQTY-AVAL_QUAN > QUAN_TO_DIS.
            DISQTY-QUANTITY = QUAN_TO_DIS.
          ELSEIF disqty-aval_quan > 0.
            DISQTY-QUANTITY = DISQTY-AVAL_QUAN.
          ENDIF.
          IF disqty-quantity > 0.
            quan_to_dis = quan_to_dis - disqty-quantity.
            MODIFY disqty TRANSPORTING quantity.
            ADD 1 TO lv_line.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM
    When i am taking characteristics LOBM_VFDAT for sort rule in Cu70 then i am not getting batch determination as i required even if i maintained Shelf expiry date in MSC3n.
    Please suggest where i must look into so that my batch determination would be based on date of consignment recieved.. currently if it s taking based on max qty available in MMBE.
    Regards
    Nitin

    I have already assigned sort rule in VCH1 but dont know which Characteristics i must assign for customer consignment stock on FIFO basis. Could you please tell me the characteristics for it which i must consider?
    LOMB_VFDAT i have already tried but its not working for me.
    Edited by: Nitin Agarwal on Oct 30, 2008 8:14 AM

  • If i click to turn off my backup and delete all backup data will I lose everything on my ipad? or will it just no longer be stored in icloud?

    currently my iphone and my ipad share data in my icloud account. if i click to turn off my back up and delete all backup data, what will happen? will i lose everything on my ipad, or will it just no longer be stored in icloud?

    It will only delete your backup from iCloud.

  • I deactivated my apple id and want to add another id to my icloud acc,how can I do this without deleting all my data from my ph?

    There is an option to delete the account, but then it says it will delete all my data, which I dont want to happen.

    When you delete icloud account off your phone it will ask you if you want to keep or delete the data. You will choose to keep and will be ok. The only thing that will reset is photostream, so if that is a concern, back up your pictures.

Maybe you are looking for