Update statement for modifying day of the month

Hi,
i hope there is an easy answer to a question i'm probably over thinking. i have a situation where i need to update all the days in a date field to a certain day of the month regardless of the month or year. Here is an example of a small number of dates in the table:
07/28/2004
04/21/2008
12/21/2011
08/21/2006
04/04/2008
04/16/2012
08/13/2011
03/01/2006
04/17/2012
So, for each of these dates the day (or DD) would need to be converted to the 15th (ie. 07/15/2004, 04/15/2008, 12/15/2011, etc). I've used to_char to pull out just the DD, but am unsure what the update statement would need to look like. Any assistance would be greatly appreciated. Thank you!

If you don't care about the time component
UPDATE your_table
   SET your_column = trunc(your_column,'MM') + 14Justin
Edited by: Justin Cave on Apr 26, 2012 9:47 PM
Off by 1. Should be +14 not +15

Similar Messages

  • How can i view appointments for a day in the monthly calendar

    how can i view appointments for a singol day in the monthly calendar?
    Thank you

    It's a problem they need to fix. Make a complaint at http://www.apple.com/feedback/

  • Select statement for last day of the last quarter and first quarter

    Anybody provide me the single select statement which should result the last day of the last quarter and last day of current quarter?
    Ex: Select last date of the last quarter,last day of current quarter from XYZ(DUAL...)
    Thanks in Advance

    Hi,
    Here's one way:
    SELECT               TRUNC (SYSDATE, 'Q') - 1     AS prev_qtr_end
    ,     ADD_MONTHS ( TRUNC (SYSDATE, 'Q') - 1
                 , 3       
                 )                    AS this_qtr_end
    FROM    dual;TRUNC (dt, 'Q') returns the first day of the quarter containing dt.
    Subtract one day from that, and you have the last day of the previous quarter.
    Add 3 months to that, and you have the last day of the current quarter. ADD_MONTHS (dt, n) will always return the last day of a month if its first argument, dt, is the last day of a month.

  • How to sum colmn for evey day in the month

    All if i have a table that has
    username, volume, date
    And i want to sum the volume for everyday of the month, does anyone have an example.

    hehe, losing my head by using analytics when they're not needed... ooops!
    SQL> with t as (select 'USERA' as username, to_date('01/01/2007','DD/MM/YYYY') as dt, 1 as vol FROM DUAL UNION ALL
      2             select 'USERA', to_date('01/01/2007','DD/MM/YYYY'), 2 FROM DUAL UNION ALL
      3             select 'USERB', to_date('01/01/2007','DD/MM/YYYY'), 4 FROM DUAL UNION ALL
      4             select 'USERB', to_date('01/01/2007','DD/MM/YYYY'), 8 FROM DUAL UNION ALL
      5             select 'USERC', to_date('03/01/2007','DD/MM/YYYY'), 16 FROM DUAL UNION ALL
      6             select 'USERD', to_date('01/01/2007','DD/MM/YYYY'), 32 FROM DUAL UNION ALL
      7             select 'USERA', to_date('02/01/2007','DD/MM/YYYY'), 64 FROM DUAL UNION ALL
      8             select 'USERB', to_date('01/01/2007','DD/MM/YYYY'), 128 FROM DUAL UNION ALL
      9             select 'USERC', to_date('03/01/2007','DD/MM/YYYY'), 256 FROM DUAL UNION ALL
    10             select 'USERA', to_date('02/01/2007','DD/MM/YYYY'), 512 FROM DUAL UNION ALL
    11             select 'USERD', to_date('01/01/2007','DD/MM/YYYY'), 127 FROM DUAL UNION ALL
    12             select 'USERA', to_date('03/01/2007','DD/MM/YYYY'), 31 FROM DUAL)
    13  -- END OF TEST DATA
    14  select username, dt, sum(vol)
    15  from t
    16  group by username, dt
    17  order by 1,2
    18  /
    USERN DT                    SUM(VOL)
    USERA 01/01/2007 00:00:00          3
    USERA 02/01/2007 00:00:00        576
    USERA 03/01/2007 00:00:00         31
    USERB 01/01/2007 00:00:00        140
    USERC 03/01/2007 00:00:00        272
    USERD 01/01/2007 00:00:00        159
    6 rows selected.

  • I have updated to IOS 6, the App store won't work, is stuck in update mode for 1 day and the battery now goes flat in 3 hrs without use. Can I go back to IOS 5?

    Hi, I was forced to upgrade to IOS 6 due to a restore.
    Since the upgrade, I have lost information, the App store is stuck in update mode, my battery drains in hours and many more problems.
    Is there a way to go back to the VERY RELIABLE IOS 5? This phone is nearly useless now.
    Thanks

    Just FYI - the situation is resolved.  I downloaded the new snow leopard 10.6.8 update for safari and now itunes works.  I have no idea what that has to do with anything - but I saw it on another forum and it actually worked.

  • Schedule Executed weekly except for a specific day of the month

    Hi all,
    I need to create a schedule that run weekly every sunday at 9 PM, except for 2nd day of the month it will run at 7 AM.
    I have created 2 schedules:
    1. One to run weekly every sunday at 9 PM, but i don't know from where i can specify the days of the month the schedule will be inactive on it.
    * I have tried By Month Day option, and choose all days of the month except second day of the month to run on it.
    FREQ=WEEKLY; BYMONTHDAY=1,3,4,5,..,31; BYDAY= SUN; BYHOUR=21;
    But, on the schedule preview window as i have designed the schedule from oracle warehouse builder, shows sunday, 02, July for example.
    as an execution date for this schedule.
    which is not appropriate.
    2. Another job is created to run monthly on the 2nd day of the month,
    FREQ=MONTHLY; BYMONTHDAY=2; BYDAY= SUN; BYHOUR=7;
    So, please advice how to create schedules daily or weekly and neglect some days of month from it.

    Hi,
    You can use the exclude clause introduced in 10gR2 for this by creating a schedule when your job should not run and excluding it. An example is given below.
    Hope this helps,
    Ravi.
    create or replace procedure print_schedule_dates
       schedule in varchar2,
       start_date in timestamp with time zone default dbms_scheduler.stime(),
       number_of_dates in pls_integer default 10
    is
      date_after timestamp with time zone := start_date - interval '1' second;
      next_date timestamp with time zone;
    begin
      for i in 1 .. number_of_dates
      loop
        dbms_scheduler.evaluate_calendar_string
         (schedule, start_date, date_after, next_date);
        dbms_output.put_line(to_char(next_date,
                        'DY DD-MON-YYYY (DDD-IW) HH24:MI:SS TZH:TZM TZR'));
        date_after := next_date;
      end loop;
    end;
    begin
      dbms_scheduler.create_schedule('monthday2',
        repeat_interval=>'freq=monthly;bymonthday=2');
    end;
    exec print_schedule_dates('FREQ=WEEKLY;BYDAY=SUN;BYHOUR=21;exclude=monthday2',sysdate+1,30);
    exec print_schedule_dates('FREQ=WEEKLY;BYDAY=SUN;BYHOUR=21',sysdate+1,30);

  • Variable to show ALL days of the month

    I have a data provider that looks like this:
    OID Name Occurence
    1 Lemons 20/10/2009
    2 Apples 21/10/2009
    3 Pearss 24/10/2009
    4 Lemons 20/10/2009
    5 Apples 21/10/2009
    I want produce a cross tab that INCLUDES the count for each day of the month even if an occurence has not happened on that date:
    Date 01/10 through to 30/10
    Lemons
    Apples
    Pears
    er how do I do this?

    Joe,
    Insert an extra dataprovider for all the days in the month with a dummy value. You can then add that dummy value in your
    crosstab and hide it.
    Cheers,
    Harry
    PS,
    Please post your mesage only once instead of 2 or 3 times.

  • App updates in a waiting state for 3 days....!!!

    Since upgrading to IO 6, I have several App updates and all have been in a waiting state for multiple days. Not one has loaded.

    The credit card on my accoutn has expired , so I have to enter another credit card information in the Settings>General > Store .
    Now I am able to install the apps , my compalin is that I should have got a message about the credit card while trying to install the apps , rather than that apps just disappearing without any message .
    Thasnk
    Bari

  • How do I add a recurring event to repeat on the fifth recurring day of the month, for example, an event that only happen on the fifth Sunday of the month for those months that have a fifth Sunday?

    How do I add a recurring event to repeat on the fifth recurring day of the month, for example, an event that only happen on the fifth Sunday of the month for those months that have a fifth Sunday?

    Create one on the first Tuesday, select repeat/monthly and take the option at the bottom.

  • How do I set a recurring event for the last day of the month on iphone 4s calendar?

    I want to set a recurring event for the last day of every month - regardless of the date/number of days in the month. I'd prefer not to have to use an app to do this.

    Hi,
    You can do this using the custom repeat in iCal. You'll need two events to cover the second and fourth Mondays.
    Create the event on the second Monday of the month. In Repeat select Custom... > Frequency: Monthly > On the: second Monday.
    Do the same for the Fourth Monday.
    Best wishes
    John M

  • SQL select Statement -first day and last day of the month - 1 year from now

    Hi,
    I need to write a SQL to get the dates in between first day and last day of the month one year from now.
    SELECT last_day(add_months(sysdate,12)) as lastday from dual
    What could be the Query to get the first day of the month one year from now..
    ie ..Sysdate - 3-DEC-2009
    Result - 1-DEC-2010
    thank you

    Hi,
    You can use TRUNC with 2 arguments to get the first DATE in a month, year, quarter, week, hour, minute, ISO year, ...
    SELECT  TRUNC ( ADD_MONTHS ( SYSDATE
                               , 12
                  , 'MONTH'
                  )     AS first_of_month
    FROM    dual
    ;The DATE returned will be in the same month, year, quearter, ... as the first argument.
    \We convered the last day of the month in [your previous question|http://forums.oracle.com/forums/message.jspa?messageID=3942939#3942939].
    At that time, I warded about using LAST_DAY as a cutoff point; TRUNC is a much better way.
    For example, to find all appointment_dates in the current month next year:
    SELECT  *
    FROM    appointments
    WHERE   appointment_date >= TRUNC (ADD_MONTHS (SYSDATE, 12), 'MONTH')
    AND     appointment_date <  TRUNC (ADD_MONTHS (SYSDATE, 13), 'MONTH')Note that
    the first part of the WHERE clause calls for dates on or equal to the beginning of the 12th month in the future, but
    the second part of the WHERE clause calls for dates before, not equal to , the beginning of the 13th month in the future.

  • Function for finding first day of the month !!

    Hi,
    I know we have function to find the last day(DD) of the month. Do we have any functions for finding the first day of the month ??? if not is there any way i can find the first date(DD) of the month .
    Bcoz i m trying to incorporate the logic for finding the first day of the month partition.
    Thank you!!!

    Shahid Ali Tcs wrote:
    There are many solution given by member in relation with your question, and all are correct .
    I want to make u know something else.
    Have you ever think why oracle has given function for last_day but no function for first.....
    I u think this question u will get the answer of your "first day finding " question.
    Because first day is alwasy 01 of every, while last day can be 30,31,29,28.....
    Got my words ........
    One more solution from my side,,,,
    SQL> select '01' || to_char(sysdate,'-MON-YY') from dual;
    '01'||TO_
    01-SEP-09Which is a completely poor way of doing it.
    Using TRUNC or LAST_DAY(..) + 1 will return a DATE datatype result.
    Your method is converting the DATE into a VARCHAR2, which then prevents further processing/date based calculations unless it is explicitly converted back to a DATE again.
    The reason Oracle hasn't provided a FIRST_DAY is because the TRUNC function already caters for it as this works with DATE's as well as NUMBER's, not because the first day is always 1.

  • Hello, since the update, and for three days no longer have access to the apple tv to my tv series bought why? I can play them on ipad but not have access to these series on apple tv

    Hello, since the update, and for three days no longer have access to the apple tv to my tv series bought why? I can play them on ipad but not have access to these series on apple tv
    Thanks

    What model of Mac? Mirroring will require a model from 2011 or later, running OS X 10.8 or later
    About AirPlay Mirroring in OS X

  • How to run procedure/job only on third business day of the month

    Hello All,
    how can i run the procedure/job only third business day of the month? I am using month table in my procedure and it gets updated only once in month and procedure doesn't need to run everyday.

    >
    how can i run the procedure/job only third business day of the month? I am using month table in my procedure and it gets updated only once in month and procedure doesn't need to run everyday.
    >
    For such a sparse schedule the easiest way is to DBMS_SCHEDULER and set the 'repeat_interval' using the BYDATE parameter.
    See Table 14-7 in chapter 114 DBMS_SCHEDULER of the PL/SQL Packages and Types doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_sched.htm#BABEJGCH
    >
    Table 114-7 Values for repeat_interval
    BYDATE
    This specifies a list of dates, where each date is of the form [YYYY]MMDD. A list of consecutive dates can be generated by using the SPAN modifier, and a date can be adjusted with the OFFSET modifier. An example of a simple BYDATE clause is the following:
    BYDATE=0115,0315,0615,0915,1215,20060115
    The following SPAN example is equivalent to BYDATE=0110,0111,0112,0113,0114, which is a span of 5 days starting at 1/10:
    BYDATE=0110+SPAN:5D
    The plus sign in front of the SPAN keyword indicates a span starting at the supplied date. The minus sign indicates a span ending at the supplied date, and the "^" sign indicates a span of n days or weeks centered around the supplied date. If n is an even number, it is adjusted up to the next odd number.
    Offsets adjust the supplied date by adding or subtracting n days or weeks. BYDATE=0205-OFFSET:2W is
    >
    The chapter has examples.

  • Display a metric differently only on last day of the month.

    Have a Daily transaction fact where unit cost of product is stored at a day/part num /business unit level.
    When we drag and drop date column and unit cost in the report like below we will have
    Date      cost
    Sep29     $10
    sep30     $12
    Oct1       $12
    Oct2       $14
    ..........ans so on
    The source sustem program runs on last day of the month around 8pm for setting up cost to reflect on 1st of every month
    But the nighly OBI load ( Runs at 2am every day) when incrementally updating Sep30 data picks up $12 from the erp and populates in OBI.
    But actually speaking, on Sep30 the cost was $10.
    There is no way of running the ERP program to run afer OBI load. Hence we need an expression in the RPD (not answers) saying
    when last day of the month (any month) the standard cost must be a previous day value.All other days the same value should be returned.
    Is this possible without impacting report performance ?
    So, when we drag and drop date and cost value the above report should change as
    Date        Cost
    sep29     $10
    sep30     $10
    Oct1       $12
    Oct2       $14
    Oct30     $12.5
    Oct31     $12.5
    Nov1      $13.5

    You can achieve the above requirement for current month alone with below steps:
    The solution requires to have a union report
    First part of the report will have Date and Cost fields with a report level date filter, Date NOT IN (TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))))
    Second part of the report will have Date and Cost fields with a report level date filter Date IN (TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_MONTH , 1, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))))In the second part of the report,
    Change the column formula for Date to display only Current_Date
    Change the column formula for Cost field with FILTER(Cost USING Date = Current_Date-1)
    Pls mark if correct/helpful.

Maybe you are looking for

  • Problem on my MSI k7n2 delta2-LSR

    I have 2 identical 512mb (tho different manufacturing date and model) twinmos ddr400 value rams. Whenever I put them in dual channel mode, I cant run any applications on windows xp, windows boots fine, just I get error when I trying to run any applic

  • Windows Crashes with JRE 1.4.2

    Hi! I work on a Java Applet/application that was originally written to run on java 1.1 -- only AWT that too. Recently I managed to convince my manager (and his manager and his manager) to migrate from the AWT framework on java 1.1 (Microsoft JVM that

  • Beachball time, Mac Mini

    OK, I know what you're thinking..that the Mac Mini wasn't designed for FCP, and that the G5 is really the only machine to work on. I used to have 2 DP G5s, so I'm aware of their power. My mini gives me huge amounts of beachball time when working on m

  • Process of costing

    hi..... i want to know all about process for cost of goods sold,cost of manufacture,cost of production. Thanks & Regards Rekha sharma

  • Read statement giving sy-subrc = 4

    read table i_cdpos with key  OBJECTCLAS = i_cdhdr-OBJECTCLAS                              OBJECTID   = i_cdhdr-OBJECTID                              CHANGENR   = i_cdhdr-CHANGENR.                             FNAME      = 'WAERS'. if sy-subrc = 0 . if