using trunc ((sysdate-1 * 12) add_months get Monday on this wk

Hello all;

I use trunc (add_months (sysdate-1 * 12)), which get me on 18/05/2010 but what I would do is bascially, if this date falls on a Monday, then getting Monday involved in this period, in this case Monday that is associated with is therefore 17/05/2010. How to get what I want to change.

Edited by: user13328581 may 18, 2011 08:36
SQL> select trunc(add_months(sysdate, 1 * -12),'IW') from dual
  2  /

TRUNC(ADD
---------
17-MAY-10

SQL> 

GOLD:

SQL> select next_day(trunc(add_months(sysdate, 1 * -12)) - 7,'monday') from dual
  2  /

NEXT_DAY(
---------
17-MAY-10

SQL> 

SY.

Tags: Database

Similar Questions

  • I had Mac Air in the month of April, now using only Safari DR.celaner shows me that I have use all RUM - 4GB. and mac gets hot. is this normal?

    It is quite new machine a few weeks it started to get hotter, Dr. cleaner shows me that I have use 4 GB of memory when I just use Safari nothing else, sometimes performance becomes very slow. I don't know what is happening.

    Dr. cleaner

    The first step is to get rid of it. If you still have a problem, please see below.

    Apps can affect the performance of Mac, battery, temperature and fan activity - Apple Support

  • "I can't access"https"sites using my Windows laptop, 8; I get "cannot display this webpage". error ".

    I have a new laptop (Sony) with Windows 8.  Straight out of the box with all the settings still on the default value of the factory.  But I can't save the laptop or set up as a computer built because trying to any Web site secure (https, IE) causes the nessage 'cannot display this webpage ".

    Original title: cannot access https

    Hi Bruno.

    I finally worked it was my anti-virus software that has a parameter for block access to https and the default value is 'on '.  Not useful.

  • For one of my projects of classroom courses, I have to use adobe illustrator.  Can I get illustrator for this project and then unsubscribe later?

    Also when I be charged for this.  Will avoid a charge?

    There are 30-day trial. You can end right now?

  • With the help of trunc (sysdate) between

    Hello - I have a question about when to use trunc (sysdate).

    In particular, I wonder whether or not there are no reason to use trunc (sysdate) in the following statement:
    select app_id from app where sysdate between start_date and stop_date
    .. .or start_date and stop_date are stored truncated (not stored in the column time info).

    Thank you!

    To some extent, it depends on you want to return. If you ran the query today, and the date of the judgment was 21-sep-2011, would you record back or not? If Yes, then you need to trunc sysdate, given that the component "hour" of stop_date's midnight, and it's almost always after midnight for sysdate (86 399 seconds per day). If this isn't the case, then it is not serious.

    John

  • How can I get rid of this virus: Trojan JS/Medfos.A =?

    I use Microsoft Essentials security. Maybe it isn't the right one? I don't know what to use to safety or how to get rid of this miserable virus. Can you help me?

    Email removed for privacy - M

    Thanks in advance for your help,
    Shulamit

    Hello

    If you are using MSE, you must scan your computer for viruses. Do a full analysis, you can get a complete analysis of your system.

    You can try these free programs to search for malicious software that work with your existing anti-virus software:

  • Error that using TO_CHAR (TRUNC (SYSDATE), 'DAY') FROM DUAL

    Hello everyone.

    I have a pl/sql procedure that contains TO_CHAR (TRUNC (SYSDATE), 'DAY') FROM DUAL to capture the DAY in a variable. Now when I access this procedure of someother application (Workflow), I get the error ORA-01841: (full) year must be understood between-4713 and 9999 and not be 0.

    If I do not use TO_CHAR (TRUNC (SYSDATE), 'DAY') and hardcode the value, it throws no error.

    Any ideas on this error?

    Is this something to do with the NLS_DATE?

    Thank you

    Kind regards

    Pavan K

    >
    ...

    IF (TRIM (SAT_DAY) = 'SATURDAY')
    THEN
    L_DAYS: = L_DAYS + 2;
    ELSIF (TRIM (SAT_DAY) = "SUNDAY")
    THEN
    L_DAYS: = L_DAYS + 1;
    ON THE OTHER
    L_DAYS: = 1; - FND_PROFILE. VALUE ('DSD_PAF_TIMEOUT'); -Getting the value of timeouit in days
    END IF;
    L_DAYS: = L_DAYS * 24 * 60;

    First, you add two days if it's a Sunday.
    Then you multiply by 24 * 60.
    Are you sure that this logic is ok?

    I guess you just use bad values for the L_days parameter.

    The difference between last Friday and today, without doubt is:

    last Friday, the variable L_days has been VERY VERY VERY big, for example 20000000 = (x + 2) * 24 * 60)

    Today, it's only 1 * 24 * 60 = 1440.

    Published by: W. Sven on September 21, 2009 18:01

    Looking at the error message...

    ORA-01841: (full) year must be between-4713 and 9999

    My current guess is that you have created a date that goes beyond the year 9999.

    Published by: W. Sven on September 21, 2009 18:05

  • trunc sysdate returns 12:08 AM

    SELECT TO_CHAR (TRUNC (SYSDATE), ' MM/DD/YYYY hh: mm AM ")"Current Date and time"from DUAL;

    ----------

    21/08/2015-12:08 AM

    If this should not return 12:00 AM... ?

    I see the example, with the same output (where I got of) mentioned in this oradoc:

    http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions201.htm

    However, the textbooks I use show 12:00 as output. Maybe something's different in my initialization?

    MM is the month, not minutes

  • Difference between Sysdate and trunc (sysdate)?

    SYSDATE and trunc (sysdate) both return the current date.

    So I would like to know is there a difference between them?

    Thank you

    DATEs in Oracle ALWAYS have a portion of time (what you call a timestamp). Using tronque() on a DATE fixed the part time at midnight that day there

  • Trunc (sysdate) question

    SQL dear Experts,

    You can specify the difference b/w the following 2 conditions. I see the same results with any of the conditions. I'm going to pull data for 24 hours and it is one of the terms I use in SQL:
    trunc (BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc(sysdate-1)

    trunc (BEGIN_INTERVAL_TIME) between trunc(sysdate-1) and trunc (sysdate)

    Published by: DBA112 on January 14, 2013 13:57

    >
    Don't forget that midnight is 00:00:00 No 24:60: 60. Midnight is still the beginning of a day.
    >
    Fix! But that's only the half of it! Midnight is also the END of a day.

    http://en.Wikipedia.org/wiki/midnight
    >
    Midnight marks the beginning and the end of each day in civil time throughout the world. This is the point of division between one day and the next.

  • trunc (transaction_date) = trunc (sysdate) is there a performance issue?

    Hi gurus,

    I wrote a code that summarize the records for a day.
    I need to put it as a daily_summary_job.

    I used expression such as:

    trunc (transaction_date) = trunc (sysdate)

    Is it a good idea to truncate the dates on both sides?
    I need to summarize the data for a day.

    Thank you

    Hi Tina,

    as others already said, using a function on a column WHERE clause prevents the use of an index on that column. Another important issue for the performance, it's that the cardinality estimates are likely to be less accurate in this case.

    You can avoid these problems by creating an index based on a function on trunc (transaction_date). In addition to creating a usable index, it will also create a virtual column for which optimizer will collect stats.

    Best regards
    Nikolai

  • Since I use sync I now duplicate bookmarks, but if I delete a bookmark it deletes it is too duplicate, how do I get rid of this second series of bookmarks?

    Since I use sync I now duplicate bookmarks, but if I delete a duplicate, it removes the copy and the original, how can I get rid of this second series of bookmarks?

    Nevermind, I just reinstalled firefox and all is well now.

  • When I opened my account of electronic mail through Firefox, there is a message flashing in my task bar "lorainemihiril" sent me a message. I DON'T know this person, I can't make it go away and I NEVER use Instant Messaging. How can I get rid of this?

    When I opened my account of electronic mail through Firefox, there is a message flashing in my task bar "lorainemihiril" sent me a message. I DON'T know this person, I can't make it go away and I NEVER use Instant Messaging. How can I get rid of this? Sometimes there is more than one of these flashing messages all with the same name.

    Disable Yahoo Messenger in your Yahoo Mail account.

    Use the arrow to the right of your account name to switch to offline or disconnected.

  • Hi, I just bought a used 2012 Pro 13 "Macbook. It came with iMovie installed. However, I would like to get the update to iMovie. He said: I can't update iMovie because a different Apple ID was used to download iMovie and I get errors. How can I update iMo

    Hi, I just bought a used 2012 Pro 13 "Macbook. It came with iMovie installed. However, I would like to get the update to iMovie. He said: I can't update iMovie because a different Apple ID was used to download iMovie and I get errors. How can I update iMovie?

    Error message #1: these applications cannot be accepted by your Apple ID. These applications have already been assigned to another Apple ID, and they will be available in this list of purchases Apple ID. If you don't have access to this Apple ID and would like to receive future updates, you will need to purchase applications.

    Error message #2: update are not available with this Apple ID. This update is not available for this Apple ID either because it was bought by another user or the item has been refunded or cancelled.

    Error message #3: we could not complete your request. There was an error in the App Store. Please try again later. (null)

    Unfortunately, free updates are available to the original purchaser of the computer. The iMovie is locked to his Apple ID, so unless you have to grab his ID, you can buy iMovie.

  • Hello. I have windows xp. If you use Firefox as my homepage, I get interference terrible display of vertical and horizontal lines. When I switch to Internet Explorer I don't get them. I want to keep Firefox as a server.

    Hello. I have windows xp. If you use Firefox as my homepage, I get interference terrible display of vertical and horizontal lines. When I switch to Internet Explorer I don't get them. I want to keep Firefox as a server.

    Here is something you can try:

    1. Click on tools and then click Options.
    2. Select the Advanced tab
    3. Select the general tab
    4. Uncheck the use hardware acceleration if available.
    5. Click file and then click on exit.
    6. Launch Firefox normally.

    Once you have followed these steps, you'll want to follow these establishments and see if the lines are gone.

    Click the Help menu and select Restart with disabled modules.

    Let me know if this has eliminated the problem.

Maybe you are looking for