Getting an error in this select

Hi,
i am getting an error on this select
select add_months(to_date('31-MAR-'||'to_char(to_date('31-MAR-2011')','YYYY'))-12) from dual
Kindly help !!!

Your format-codes are wrong and sometimes missing.
Please try this:
select add_months(to_date('31-MAR-'||to_char(  to_date('31-MAR-2011','DD-MON-YYYY'),'YYYY'),'DD-MON-YYYY'),-12) from dual;I did correct it, but it is not nice code. Why do you use the same constant value (31-MAR) twice? The second is only for extracting the year. You could do the same with this:
select add_months(to_date('31-MAR-2011','DD-MON-YYYY'),-12) from dual;Keep in mind: There is a dependency of the setting of NLS_DATE_LANGUAGE in this code. NLS_DATE_LANGUAGE should be english for you code.
For example if NLS_DATE_LANGUAGE is GERMAN the code for march will be 'MRZ' instead of 'MAR'.
The following code would be language independent:
select add_months(to_date('31-03-2011','DD-MM-YYYY'),-12) from dual;Edited by: hm on 11.09.2011 22:51

Similar Messages

  • Why am I getting an error in this Select statement ?

    Any reason why this SQL string does not work on Oracle ?
    SELECT * From kestjori.vatnshaed_web WHERE TIEINS = '1' AND TIDTIM BETWEEN To_Date('01.01.2000') AND To_Date('27.10.2000');
    TIEINS is of the datatype NUMBER(3)
    TIDTIM is of the datatype DATE
    I am getting this error :
    SQLException: [ORACLE][ODBC Oracle Driver][Oracle OCI] ORA-00911: invalid character
    With thanks in advance,
    Oskar Jensson

    i think there is one exact problem in sql and other is optional.
    1. u write field
    TIEINS is of the datatype NUMBER(3)
    but in query in where part u write
    where TIEINS = '1'
    so problem is of data type.
    second optional problem can be removed by given date format in to_Date() function.
    like To_Date('27.10.2000','dd.mm.yyyy')
    i hope it will help u
    bye
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Oskar Jensson ([email protected]):
    Any reason why this SQL string does not work on Oracle ?
    SELECT * From kestjori.vatnshaed_web WHERE TIEINS = '1' AND TIDTIM BETWEEN To_Date('01.01.2000') AND To_Date('27.10.2000');
    TIEINS is of the datatype NUMBER(3)
    TIDTIM is of the datatype DATE
    I am getting this error :
    SQLException: [ORACLE][ODBC Oracle Driver][Oracle OCI] ORA-00911: invalid character
    With thanks in advance,
    Oskar Jensson<HR></BLOCKQUOTE>
    null

  • Just downloaded iTunes to new dell laptop, tried syncing my iPhone get an error message:  "this iPhone cannot be used because the Apple Mobile Device service is not started".  What does this mean? I have had this phone for over a year..

    Just downloaded iTunes to new dell laptop, tried syncing my iPhone get an error message:  "this iPhone cannot be used because the Apple Mobile Device service is not started".  What is the issue, had this phone over a year??

    I had this problem before. I like to disable extra services to speed up my computer and I disabled the Apple Mobile Device service and had to re-enable this.
    You can do that by going Control Panel>Administrative Tools>Services. Once you have gone to the services window, look for Apple Mobile Device and right-click. Select "Properties". There should be some information about the service as well as the label "Startup Type" with a drop-down menu beside it. If it says "disabled", that is your problem; Change the selection to anything except disabled (Automatic is easier and ensures that you can sync as soon as itunes opens).
    If this doesn't work, I would look into your anti-virus' settings. Good Luck!

  • HT1911 When I click on my iTunes I get an error note "This copy of iTunes is corrupted or is not installed correctly.  This is after just loading the newest version tonight??

    I just donloaded the newest verion of iTunes.  Now when I click on my short cut I get an error message "This copy of iTunes is corrupted or is not installed correctly.  Please reinstalliTunes.
    How do I get back into my account and retrieve my itune library?

    Let's try a repair install of iTunes.
    Restart the PC first.
    If you're using Vista or 7, now head into your Uninstall a program control panel, select "iTunes" and then click "Repair".
    If you're using XP, head into your Add or Remove Programs control panel, select "iTunes", and click "Change". Select "Repair" and click "Next" as per the following screenshot:
    Can you launch your iTunes now?

  • I'm getting an error saying this iphone mobile service is not started..what is that means. cannot sync with my itunes

    i'm getting an error saying this iphone mobile service is not started ... what is that means...cannot sync with my itunes

    Try this,
    Close your iTunes
    Click the Windows Start button
    In the "SEARCH" box, type in SERVICES
    In the Program Section of the search result, Click "Services"
    Select "Apple Mobile Device" and click the "STOP the service"
    After the services has stopped, Click "START the service"
    After the Apple Mobile services has started again, open iTunes and connect the device.

  • In iCal - I keep getting the error message " This calendar was created by Mail" and it will not accept any input; why..??

    In iCal - I keep getting the error message “ This calendar was created by Mail” and it will not accept any input; why..??

    use Disk Utility and Verify Permisions then fix and Verify Disk and fix, this should fix it.

  • I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version.  How do I update my PHONE and why is an itunes update being confused for my iphone?

    I'm trying to update my iphone 3GS to the 4.3.4 version and I am getting the error message "This version of itunes (version 9.1.1) is the current version.  How do I update my PHONE and why is an itunes update being confused for my iphone?

    You need iTunes 10.0 or greater to update your phone...iTunes isn't confused at all. If you're on a Mac, you'll need OS X 10.5.8 or greater to update iTunes to 10.0 or greater.

  • I recently tried to update iTunes to 11.1, and am now getting an error message "This application has failed to start because MSVCR80.d11 was not found."  I have uninstalled and reinstalled iTunes multiple times.  Am running Windows XP Svc Pack 3.  help

    I recently tried to update iTunes to 11.1, and am now getting an error message "This application has failed to start because MSVCR80.dll was not found.  Reinstalling the application may fix this problem."  I have uninstalled and reinstalled iTunes several times with no success.  I am running Windows XP Svc Pack 3.  Help please.

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99753)

  • When I try to save a form as "Reader Extended PDF" in Acrobat Pro, I get an error message "This document could not be reader enabled".

    Hello,
    When I try to save a form as “Reader Extended PDF” in Acrobat Pro, I get an error message “This document could not be reader enabled”.
    The steps I’m following are described below:
    1.    Insert electronic signatures
    - In Tasks, click on “Add New Field -> Digital Signature”.
    - Move the square to the place where you want to put the signature and click.
    - Fill in the “field name” with the name of the person who has to sign here.
    - When it is done, click anywhere on the screen.
    - In Tasks, click on “Close Form editing”.
    - Go to menu “File -> Save as -> Reader Extended PDF ->Enable additional features”, click on “Save now”.
    - Fill in the file name and click on “Save”.
    2.    Save the Form
    - In Tasks, click on “Close Form editing”.
    - Go to menu “File -> Save as -> Reader Extended PDF ->Enable additional features”, click on “Save now”.
    - Fill in the file name and click on “Save”.
    I am using Adobe Acrobat Pro 10.0.0 on a W7 workstation
    Here's a screenshot of the problem.
    Thanks a lot.
    Gael

    Read the user manual that came w/the scanner and/or contact HP Support.
    http://support.apple.com/kb/PH14141 OS X Mavericks: Reset the printing system 
    http://support.apple.com/kb/HT3669 Printer and scanner software available for download 
    A scanner driver you may wish to consider:  VueScan Scanner Software

  • HT204053 I am running Windows 7 and have tried to install iCloud.  No matter what instructions I follow, I still get the error message "This Apple ID is valed but is not an iCloud account."  How can I resolved this?

    I am running Windows 7 and have tried to install iCloud.  No matter what instructions I follow, I still get the error message "This Apple ID is valed but is not an iCloud account."  How can I resolved this?

    I've tried both. First, I tried on my pc, where iTunes had installed iCloud when it last updated. I have iTunes installed on this computer (and on my iPad and iPhone), but that wasn't the issue.
    So I went online, thinking I needed a separate iCloud Apple ID, but it prompted me for my current Apple ID and gave me the message about my ID being "valid" but not an iCloud account," which, lol, was what it had asked me to do in order to create one. I checked, and at least one other user is having the same issue. I'll attempt to copy/paste the Support request url: https://discussions.apple.com/thread/4430653?tstart=0
    Thank you for any help you can give.
    Trish

  • Problem with saving a pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21).

    Need advice on a saving file issue. I'm having problem with saving a .pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21). This is new as this error message just recently started to pop-up.

    More information about this issue can be found here:
    https://forums.adobe.com/thread/1672655
    A "quick" fix that worked for me was to uninstall Adobe... then download the base install for Adobe Reader 11.0.
    Then download each of the individual updates and run them sequentially. 
    I've installed back up to the last security update which is version 08 and have been able to do normal Save As operations.
    You will have to disable automatic updates in order to stay at version 08 until Adobe resolves this issue in a later release.
    http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows
    Adobe Reader 11.0 - Multilingual (MUI) installer    AdbeRdr11000_mui_Std
    Adobe Reader 11.0.01 update - Multilingual (MUI) installer    AdbeRdrUpd11001_MUI.msp
    Adobe Reader 11.0.02 update - All languages    AdbeRdrSecUpd11002.msp
    Adobe Reader 11.0.03 update - Multilingual (MUI) installer    AdbeRdrUpd11003_MUI.msp
    Adobe Reader 11.0.04 update - Multilingual (MUI) installer    AdbeRdrUpd11004_MUI.msp
    Adobe Reader 11.0.05 security update - All languages    AdbeRdrSecUpd11005.msp
    Adobe Reader 11.0.06 update - Multilingual (MUI) installer    AdbeRdrUpd11006_MUI.msp
    Adobe Reader 11.0.07 update - Multilingual (MUI) installer    AdbeRdrUpd11007_MUI.msp
    Adobe Reader 11.0.08 security update - All languages    AdbeRdrSecUpd11008.msp

  • When I try to play a song in my itunes libery I get an error saying "this song could not be used because the original file could not be found".  I do I restore the file?

    When I rry to paly a song in my itunes libery, I get an error saying "this song could not be used because the original file could not be found". I do I find the orginal file?

    Hello crispinofromfl,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    Where are my iTunes files located?
    http://support.apple.com/kb/ht1391
    Have a nice day,
    Mario

  • I have a problem with installing PS13 as I get an error message "This installer does not support installation on a 64-Bit Windows operating system. Please download the 64-Bit version of Photoshop Elements." how do i do this?

    i have a problem with installing PS13 as I get an error message "This installer does not support installation on a 64-Bit Windows operating system. Please download the 64-Bit version of Photoshop Elements." how do i do this

    Try downloading the trial. It ought to detect that you have a 64-bit system.
    You aren't using Vista, are you? PSE 13 requires at least win 7 and I think a few folks with vista have gotten a similar error message on trying to install it.

  • Excel 2010: I get the error message "This file can't be previewed because of an error in the Microsoft Excel previewer." even though Advanced Properties is set to Save Thumbnails for all Excel Documents.

    Excel 2010: I get the error message "This file can't be previewed because of an error in the Microsoft Excel previewer." even though Advanced Properties is set to Save Thumbnails for all Excel Documents and I've run Repair on Microsoft Office.
     I don't know what else to try.
    Any help would be appreciated. Thanks.

    A hotfix request has already been submitted for this issue and we have also documented it here
    http://support.microsoft.com/kb/983097
    Thanks.
    Tony Chen
    TechNet Community Support

  • While upgrading Adobe Creative Suite CS4 ME into Adobe Creative Suite CS5.5 Design Premium, I get an error saying This serial number is not of a qualifying product, please try another. I used to be able to get a code from customer service but I can't get

    While upgrading Adobe Creative Suite CS4 ME into Adobe Creative Suite CS5.5 Design Premium, I get an error saying This serial number is not of a qualifying product, please try another. I used to be able to get a code from customer service but I can't get to the chat. Please advise!!!!

    MoeGhazal I reviewed your account and it looks like you have have upgraded from a CS4 volume license for Design Premium to a retail upgrade of Design Premium 5.5.
    I also show that you made two purchases of CS5.5 Design Premium but the second purchase was canceled.  Please make sure you are utilizing the serial number which ends in 7886.
    If you are using the correct serial number then it is likely the installer will not recognize your volume license CS4 serial number as being valid for an upgrade.  If you can contact our support team then you can be walked through an unlocking procedure to allow you to proceed with the installation.  You can contact our support team directly at Contact Customer Care.  You may want to try installing a web browser you have not previously utilized.  It is likely a toolbar or some other software application is affecting your ability to access chat support successfully.
    If you are still unable to reach our support team then please verify the information under your account is accurate.  If you can please then update this discussion after confirming this then I can request a member of our support team contact you directly.
    Again I would recommend reaching out directly if possible as it will be the most efficient method of resolving your current error.

Maybe you are looking for