Delete on the basis of date

Hi All,
I need to delete data from a table based on a date column. If the date in DATE column is 180 days old than current sysdate then it should delete otherwise not.
So i found out below two ways
1. Use sysdate-tab_date >180 in where clause
2. Use MONTHS_BETWEEN(sysdate,tab_date)*30 > 180
Please let me know what way would be performance efficient & faster. If you have any other way then please share that too.
Also Is there any way we can disable the writing into UNDO tablespace before deleting bulk data from database.
Thanks In anticipation.

ZahKar wrote:
user4198564 wrote:
1. Use sysdate-tab_date >180 in where clause
2. Use MONTHS_BETWEEN(sysdate,tab_date)*30 > 180In my opinion there won't be much difference in performance in above two. But 1 is a better way to do it as 2 will not be 100% accurate because you are multiplying months with 30 and the fact is that a few months will be of 31 days.They will both perform badly in comparison to a method that calculates a date six months ago and compares the tab_date directly to it.
MONTHS_BETWEEN(sysdate,tab_date)*30 > 180 is equivalent to MONTHS_BETWEEN(sysdate,tab_date) > 180/30 which is equivalent to MONTHS_BETWEEN(sysdate,tab_date) > 6. so it is correct, I believe, but it will still perform badly. actually, I can't believe anyone thought of doing MONTHS_BETWEEN(sysdate,tab_date)*30 > 180 ... converting to a month difference and then attempting to convert to a day difference?
And 180 is not even a half of 365.
Also Is there any way we can disable the writing into UNDO tablespace before deleting bulk data from database.UNDO is created to allow the change to be rolled back in the event of an explicit ROLLBACK command or an error being raised during the SQL execution (eg finding a value in a varchar2 that raises an error when you attempt TO_DATE on it) or an instance failure and subsequent recovery. It would be extremely unsafe to be able to disable UNDO generation.

Similar Messages

  • ALE Serialization on the basis of Data Value

    Dear All ,
    I have a query related to scheduling of Inbound IDOC .
    I am using a scenario Legacy system to SAP using ALE layer communication . For Goods movement IDOC WPUWBW01 I am having 7 or 8 files and each files are posting one IDOC in SAP . Now since each files are having diffrent movement types so I need to serialize the posting of IDOC into SAP based on Movement type and I have to put a condition that file with movement type 303 should be posted first and then movement type 305 should be posted .
    Approach : <b>I know ALE Serialization for the message type and used SAP Inbound Processing program RBDSER04 and did the serialization .</b>
    <b>But I am not able to do serialization for Movement Type .Can anybody help me on this ? .</b>
    Thanks & Regards
    Prabhat

    The scenario was similar. Files containing IDOCs (for goods movement) were posted to the system using custom ABAP. We wanted to ensure that the IDOCs are posted in sequence of movement type (we wanted 131 posted before 261 for example, even when 261 file came first).
    One option is to create specific message types (say Z301 for bringing 301, Z302 for brining mvt 302 and so on) and then you can use your method to serialize based on message type. But, you will have quite a few Z msg type in this case (not a big issue, but not very sophisticated).
    Other option might be to copy this program into a Z version. Inside, there is a sorting of IDOCs (search for SORT statement). This is to be modified so
    - read data from edid4 for all idocs (in 64)
    - map data to segments so as to get the mvt type
    - store in a reference table (with idoc no and mvt type)
    - apply your sort logic on this table to get the sequence of IDOCs
    - proceed with standard logic to post data in this sequence.
    Hope this helps.

  • Partitioning on the base of date

    hi,
    im having a PROBLEM IN CREATING A TABLE containing a date column having range partitioning on it. my table an accompanying error is :
    CREATE TABLE A123 (A NUMBER, B DATE)
    PARTITION BY RANGE (B)
    (PARTITION B1 VALUES LESS THAN (TO_DATE((SYSDATE - INTERVAL '30' DAY),'DD-MON-YYYY')))
    (PARTITION B1 VALUES LESS THAN (TO_DATE((SYSDATE - INTERVAL '30' DAY),'DD-MON-YYYY')))
    ERROR at line 3:
    ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE
    i'v also tried it as:
    CREATE TABLE A123 (A NUMBER, B DATE)
    PARTITION BY RANGE (B)
    (PARTITION B1 VALUES LESS THAN (TO_DATE(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')))
    (PARTITION B1 VALUES LESS THAN (TO_DATE(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')))
    ERROR at line 3:
    ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE
    as shown above,,i want to create partitions of the table A123 column b which is of date datatype,,i want to have a partition which stores data of SYSDATE - 30,.
    Any suggestions/recommendations would be appreciated.
    thanx
    Regards

    hi,
    sorry im calling u again for support,,
    the way u told for creating a table based on date column partitions creates a table with fixed date as a HIGH/UPPER BOUND,,for example if i create a table A123 as :
    begin
    execute immediate 'CREATE TABLE A123 (A NUMBER, B DATE)
    PARTITION BY RANGE (B)
    (PARTITION B4 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '90' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
    ,PARTITION B3 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '60' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
    ,PARTITION B2 VALUES LESS THAN (TO_DATE(('''||to_char(SYSDATE - INTERVAL '30' DAY,'DD-MON-YYYY')||'''),''DD-MON-YYYY''))
    ,PARTITION B1 VALUES LESS THAN (MAXVALUE))';
    end;
    ALTER TABLE A123 ENABLE ROW MOVEMENT
    now the HIGH VALUE for partition B2 is January 03,2005...
    while i want it to be dynamic.
    means after 2 months the high value for B2 partition should be (Jan 03,2005 + 2 months)..
    can we do this in oracle??
    Regards.

  • Base Line date issue

    Hi Experts,
    I have an issue on base line date.
    We have uploaed Vendor Open item cutover data through LSMW in foreground mode.  After uploaed we found that the base line date 30.07.9999 is automatically picked wrongly in some of vendor open items.  Some of the vendor items with same payment term is picked baseline date correctly. I have corss checked in LSMW upload fields and upload excel file and also i have checked in LSMW constant values and any field mapping for baseline date but there is no such mapping and constant values in the LSMW.   If i make manual posting of the same vendors its fetching the correct base line date.
    now the issue is how to identify the cause, is it uploaed through lsmw or manual input because client is asking how it is picking defaul 9999 year. Is there any way to identify through FI Tables.
    Kindly suggest some solution.
    Thanks in Advance.
    regards,
    Surendra.

    Hello Surendra,
    The baseline date is controlled by your terms of payment and in
    customizing the transaction is OBB8. You have four choices ->
    No default - Indicator that no default value is required for the
                 baseline date for payment. You then have to enter the base
                 date manually during document entry.
    Posting date - Indicator that the posting date is to be proposed in the
                   base date field during document entry.
    Document date - Indicator that the document date is to be proposed in
                    the base date field during document entry.
    Entry date - Indicator that the entry date is to be proposed in the
                 field "Base date" during document entry.
    The system will not re-determine the baseline date if the posting
    date is changed. Similarly, if the invoice date is changed and the
    baseline date is based on the invoice date, it will also not be
    re-determined once enter is pressed.
    regads
    Ray

  • Change the Net Due Date of a vendor Document

    Hi,
    Can anyone please tell me if it is possible to change the net due date of an AP Local document (doc. type = RE) generated by MIRO?
    I`ve tried to change the base line date (Bline date) but this field is unavailable to be changed in my company`s SAP.
    There is any other way?
    Thanks in advance!

    Hi
    You can change the payment terms
    Also
    To make any field as modifiable check the document change rules in OB32
    Regards
    Sach!n

  • Issue in creating Duet  Demand Planning Sheet on the basis of Dataview

    Hi all,
    We are using following landscape
    Landscape Details-
     SAPAPO = SCM 700 0002 - SAPKY7002
     Duet 1.5 - 150.700 SP3
     Duet Demand Planning u2013 1000.150.700.3.0 (Server Component), 1000.150.700.3.0 (Client Component)
    There are 2 ways available to create Duet Demand Planning Sheet
    1. On the basis of existing Demand Planning Scenario
    2. On the basis of existing Data views( with SAP macros)
    We are able to create Duet planning Sheet with 1 option. But we got erro with second Option that is on the basis od Data view(with macros).
    Planning area, Planning Book/Data view and Selection Ids are existing and active.All the Webservices given by SAP are released.
    Duet is able to retrive the list of Dataviews avilable for the Planning Area. But it is failing to retrieve the Data View Details the Error is as follow
    "No view Details were found Please choose another dataview."
    Web Service Call (PlanningViewDetails):
    java.rmi.RemoteException:Service call exception; nested exception is:
    java.rmi.UnmarshalException: Attribute schemeAgencyID is required in element ID !
    Data: TYPEID DUET_JAVA_ADDON
    Data: SEVERITYCODE 2
    Exception of type 'System.Exception' was thrown.
    Is there any SAPNOTE for this ?Any specific configuration requirement from SAPAPO side?
    Any webservices to be applied?
    Please help in this Issue
    Thanks &  Regards
    Rahul

    Hi
    There are couple of OSS  notes, you might have already seen:
    1371328 Internal Error using Planning Book with Aux. KF
    1431661 Duet Demand Planning 1.5 SP4.
    Regards
    Datta

  • Setting Payment terms in PO linking to base line date for payables.

    Hi
    can some help me by giving me simple  steps to create  the payment terms which will be captured in PO and payment is made with reference to baseline date.
    Example :
    1. payment in 15 days from the date of GRN posting date. while doing MIRO, the base line date will be proposed 15 days from the date of GRN posting date.
    2. payment in 30 days from the date of GRN posting date. while doing MIRO, the base line date will be proposed 30 days from the date of GRN posting date.
    while doing MIRO, the base line date will be
    rgds
    Raghu

    Hi
    There is no link between GRN posting date and proposed base line date for payment in MIRO. All that you can link is the posting date/ document date in MIRO etc with base line date calculation in invoice.
    Create a new payment term with posting date (the current date will be defaulated as posting date in MIRO always) and with some payment discount terms say after 15 days etc..
    Thanks

  • GRN date as deafult Base Line Date in MIRO

    Dear All,
    The client requirement is like this,
    The default Base Line date for MIRO Document should be the GRN Date (MIGO Date). But in Payment Term configuration only Document Date, Posting Date, No default, Entry Date are there. We can change the base line date at the time of MIRO.
    But Client requirement is it should come by default at the time of doing MIRO,
    Is there any user exit or enhancement for this.
    Sree

    Hi,
    We have come across this requirement in some implementations and the workaround is done this way:
    During Inovice Verification leave the system to determine Base Line Date based on standard settings.
    You can anyhow change the baseline date in document change mode.
    Have a Development which can identify the docuements posted during a period say every day and get the base line date changed on your logic (you would able to get the full trace with GR).
    Have this program executed every day on background.
    Your logic should also take care of invoice verifications with multiple GRs made at different time for the same invoice (usually the last GR date is taken in this circumstance).
    Hope this helps you.
    Varadharajan

  • Base Line Date in MIRO

    Whilst , I  appreciate  that the BAse Line date in MIRO can capture (1) Invoice Date (2) Posting Date or (3) system Date. Is there any way to capture GR-date . Shall be grateful, if you could kindly help me out
    Kind regards

    Hi,
    U can use the user exit to do this, take a help with ABAP ers and do it.
    Regards,
    Nagarajan

  • Due date falls on 80 days from base line date ........but end of that month

    Hi All
    Can any one please guide me in creating a payment term
    The Base Line Date would be 80 days from Posting date ........... But end of that month
    Example
    Posting date 01.01.2009 so the base line date would be on 21st March
    01.01 ;          31.01 ;                            31 Days
    01.02 ;          28.02 ;                            28 Days
    01.03 ;          21.03 ;                            21 Days               80 Days              
    But due date should fall on end of that month 31st of march
    So irrespective of any day calculated as above in that month  it will always take the baseline date as last day of the month    
    Its Picking up the posting day as Baseline date from Transaction VA01 -> Additional data tab -> ETD ( Festinated Time of Departure)
    From this date it need to calculate the due date as above ( 80 day but last day of the month)
    Please Guide
    Many thanks in advance
    Aadi

    Hi Aditya,
    You may have to create 2 payment terms using the day limit option to meet this requirement.
    Follows the below steps -
    T-code OBB8
    Term 1
    Payment terms = xxxx (as you wish)
    Day limit = any number between 10-15 (you may fix an appropriate date as you think fit for your business)
    Default for baseline date = Posting date
    Payment terms/fixed date = 31
    Payment terms/additional months = 2
    Term 2
    Payment terms = same name as above
    Day limit = 31
    Default for baseline date = Posting date
    Payment terms/fixed date = 31
    Payment terms/additional months = 3
    Logic here is... for all invoices with posting date on or before 10th-15th of a month, 80th day will fall definitely on the 2nd month. Invoices with posting date after 15th, the 80th day will fall on the 3rd month.
    You have to take a concious decision on the day limit number. Because 80 days will not exactly work for all the months.
    Regards,
    Mike

  • Data acquisition on the basis of time

           Hi everyone,
    I want to acquire the radial run-out (radial small displacement) of a rotating spindle using a capacitive sensor. To do so I will use the LabView v. 7.1. The PCI-6036E card from National Instruments (NI) will be utilized for data acquisition. The spindle turns at 100 rpm and a rotational incremental encoder is fixed at rear of spindle. This encoder provides an index digital pulse per revolution. This pulse should be used to start and finish the sampling process. I want to sample on the basis of time, by means of sampling rate of the card (Ksamples/s). So, let us suppose that I want to acquire 500 data/rev. The spindle takes 0.6 sec to complete one revolution. Thus, the required sampling rate is Fs = 500 samples/0.6 s = 833 samples/s. So, I should set the VI in LabView so that it samples only 833 data/s. Therefore, I will have to reduce the sampling rate of the analog-input channels in use. For example, let us suppose that the card provides 100 Ks/s when operating in multiple channels. Let us admit that there are 4 analog-input channels in use. So, the scan rate per channel is 25 Ks/s. This is too much for this application. I only need 833 samples/s. So, I should program the VI so that the card provides that required sample rate. As said earlier, I need to start and end the sampling process at the same point. Thus, to do that the index pulse of the encoder will be used. Also, I want to sample during 5 consecutive revolutions of the spindle. So, by means of a loop in VI, I should count the index pulse of encoder until the number of pulses be equal to 5 (= number of revolutions). At this instant, the sampling process should be stopped. Note: 1) the sampled data should be put in a buffer. After the sampling process is finished, this data should be saved in a file of LabView; 2) In fact, the data acquired by the sensor are voltage analog input. Questions:1) Could you make a VI for this problem, please? Note: you can use the DAQ ASSISTANT EXPRESS VI or DAQmx TASK NAME CONTROL method2) What should I do to stop the data acquisition at the end of 5 revolutions using the index pulse of encoder?3) Could you send examples (VIs) similar to my problem above? In anticipation, thank you very much for any help. My e-mail: [email protected]                                                                                      
     Bruce  

    duplicate post
    Continue in other thread
    Message Edited by smercurio_fc on 11-14-2008 09:10 AM

  • Particular data in a report, on the basis of the values (0, 1) of a dashboa

    hi
    User should be able to see the particular data in a report, on the basis of the values (0, 1) of a dashboard prompt.
    For e.g. if the user selects 0 then current years data should be filtered out
    and if the user selects 1 then rest all years data should be displayed in a request.
    give me hint regarding this question

    Hi,
    I hope this will help you
    http://oraclebizint.wordpress.com/2008/01/17/oracle-bi-101332-selecting-reports-from-dashboard-prompts-and-guided-navigation-sections/
    In this example he used prompt for selecting Region sales and Brand sales which you can replace with 0 and 1
    Phani.

  • Data Not loaded from  ap_invoice_lines_interface to the base table

    Hi ,
    Please I'm working on Interface which load invoices from Cobol system to oracle , anyway procedure is working on fine & all data is loaded to the interface as i'm inserting 4 attributes which is DFF on the invoice line level
    Now when i ran the import program all data is loaded to the base table except one of the attributes isnot loaded .
    will anyone tell me what is the reason or how can i trace that ..........
    Thanks In Advance

    Dear All ,,,,
    Please i got it's a matter of size of the attribute1 segment i increased it ,,,,,,,,,but now the issue that data is saved in the base table but not showing in the screen
    will you please help me in that
    Edited by: miro_feps on May 21, 2012 1:01 AM

  • How to delete all the PSA data in one go

    Hello Guys,
    I want to clear all the data from all the PSA tables at one shot, how can i do this??
    I have tried following things:
    1) I have gone to PSA root node and right click and then clicked on delete PSA data, but its showing me all the datasources and when i am executing that, it is deleting one by one(that i means i need to select individual datasource, which i do not want).
    2) Above specified step runs RSPSADEL1 in background , so i doubt whether it deletes psa data only or complete Table?
    3)I got the info from other posts that there is a fm which is RSATREE_PSA_DELETE_BATCH, but i need to make myself clear whether this fm deletes only data or complete Table?
    I am using sap-bw 3.5.
    Regards,
    Dolly

    Hi,
    there is one easy way to delete data from PSA .You can create a process chain have one delete data from PSA step where you need to give PSA table name and request older than (no of days before which you want to delete data ).
    Execute it and it will delete all the data before specified no of days .You can add multiple PSA tables here and can delete whole data in one go .
    Regards,
    Jaya

  • Error : Period dimension 'Period' is missing a Base Time Period member 'Jun' that has been deleted since the last deployment. Base Time Period members cannot be deleted once the dimension is deployed

    HI,
    I am using V11.1.2.2 Hyperion Planning. I am currently getting an error:
    Error : Period dimension 'Period' is missing a Base Time Period member 'Jun' that has been deleted since the last deployment. Base Time Period members cannot be deleted once the dimension is deployed
    This is what i got when i tried to add alternate hierarchy to my shared dimension. I tried to delete it and it messed up.
    NOw it wont deploy my application.
    Can any one suggest.
    Thanks in advance
    Cheers,
    XXX

    EPMA!!!!! EPMA!!!!
    I'm playing around with it to write a blog post and it is crazy. Only possible workaround (till now i'm not able to figure out a solution to it) is to copy the application and deploy it as a new one. Take copy of all objects (forms, tasklist etc). Delete the corrupted application and rename the new one to old.
    Regards
    Celvin
    http://www.orahyplabs.com

Maybe you are looking for

  • HP Touchpad - Hardware Support Outside of US

    I purchased an HP Touchpad thru ebay sometime ago.  I notice recently there is a one or two pixel horizontal line which appears 0.6 of an inch from the top border (it is slightly below the notification bar and runs parrallel to it. This line will sho

  • Preloader with skip button

    I have a preloader working fine but having problems integrating a "skip" button (so users can skip opening animation) Each of the code blocks ("//skip it" and "//Preloader" work ok without each other but when I combine them I get; "Error #1009: Canno

  • Iphone 5 power botton

    power botton not working after restoring my iphone 5 i change the power and volum flix cable 2 times and still not woking i am sure it's not hardwear problem so i restore it agine and still as is it nothing change i fix the old organel voluem and pow

  • Spell check and word suggestion doesn't work Droid 4

    My wife and I both have Motorola Droid 4s. I have had mine for almost a year, and she has had hers just a week. After I factory reset mine to fix a spell check problem, I noticed that the spell check still doesn't automatically fix errors, and there

  • Control of LR and image location

    This is number three attempt so not sure how many times this will show up. I have the new LR and when inserting my SD/CF II card into the card reader the images have no choice but to go to LR which in NOT where I wish them to reside. I have a separat