To_date function working correctly?

Hi Guys,
Trying to get dates from the table where the date is less than 100 AD but its not working correctly. Could you please comment where Im going wrong?
Thanks,
St
select plan_1_date from TR_PLANNED_EVENT where plan_1_date < to_date('100AD','YYYAD')

Saurabh T wrote:
You should compare similar date formats.Dates don't have formats.
>
Try below to make date formats similar:
select plan_1_date from TR_PLANNED_EVENT where to_char(plan_1_date, 'DD-MON-YYYY') < to_char(to_date('100AD','YYYAD'), 'DD-MON-YYYY')
This is called string comparison and is not comparing dates and will produce the wrong answer like this -
SQL> with mytable as
  2    (
  3    select date '2010-01-28' + level mydate from dual
  4    connect by level <= 5
  5    )
  6  select mydate, sysdate from mytable;
MYDATE     SYSDATE
01/29/2010 07/13/2010
01/30/2010 07/13/2010
01/31/2010 07/13/2010
02/01/2010 07/13/2010
02/02/2010 07/13/2010
SQL> edi
Wrote file afiedt.sql
  1  with mytable as
  2    (
  3    select date '2010-01-28' + level mydate from dual
  4    connect by level <= 5
  5    )
  6  select mydate, sysdate from mytable
  7* where to_char(mydate, 'DD-MON-YYYY') < to_char(sysdate, 'DD-MON-YYYY')
SQL> /
MYDATE     SYSDATE
02/01/2010 07/13/2010
02/02/2010 07/13/2010
Hope it helps.It is very unhelpful and incorrect.
Edited by: 3360 on Jul 13, 2010 8:08 AM

Similar Messages

  • T42p vista fn + f3 and fn + f4 functions (turn off screen and sleep) not working correctly

    Hi -- I recently installed windows vista on my T42p.  It works fine except that the fn+f3 and fn+f4 functions do not work as expected.  Before installing the hotkeys driver, the fn+f4 function worked correctly while f3 did not (going to sleep worked, turning the monitor off did not).  I then installed the recommended hotkeys driver.  Now fn+f4 makes the monitor turn off while f3 does nothing ... fn+f4 is supposed to put the laptop to sleep.  On top of this, if i select "sleep" from the start menu, the computer turns the monitor off instead of going to sleep.
    Presumably, the sleep button could still be telling the computer to go to sleep, but the actual operation of going to sleep is now broken?  Just a guess.  Anyways -- anyone know how to resolve this so that fn+f3 turns my monitor off and fn+f4 puts my computer to sleep?

    I've too this problem, but more, my sound mute wasn't worked (for deblock, but it can block it few second before...) 5 days in 5-6 instalation of three version of winxp: winxp ru x64 sp2, winxp es/ru sp3 x32.
    eventually I've found and ran "TPOSDSVC.exe" in instalation directory and it give an opportunity  deblocking the sound volume!!!!!!!!!!!! and I don't need more functions 
    volume levels and brightness adjustment worked well without OSD (before I ran TPOSDSVC.exe) and with OSD.
    and now I don't know worked this bustered sound driver in winxp x64.
    ThinkPad T61 7664

  • The javascript functions are working correctly, but still get scripting error messages

    When you open or run any javascript functions in this form, error messages pop up, but functions work correctly. Anyone that can help me get rid of error messages? Screenshots are attached.

    can you please share the error messages.

  • Info on TO_DATE function

    After seeing many questions on TO_DATE function,I think it will be better to post
    this useful information on to_date function.please correct me if i am wrong
    anywhere in the post.
    TO_DATE :
    SYNTAX:TO_DATE(i/pstring[,i/pstringfmt[,nlsparam]])Note:Apart from third party tools which have their own default settings,the output of to_date is in the format specified by NLS_DATE_FORMAT parameter in NLS_DATABASE_PARAMETERS view.
    Note: The format that we are specifying in to_date function is the format of the i/p string
    and not the format of the o/p date.
    Ex:
    SQL> select to_date('12-JAN-2008','DD-MON-YYYY') from dual;
    TO_DATE('
    12-JAN-08
    SQL> select to_date('12-01-2008','DD-MM-YYYY') from dual;
    TO_DATE('
    12-JAN-08
    SQL> select to_date('12/01/2008','DD/MM/YYYY') from dual;
    TO_DATE('
    01-DEC-08Q) So, for to_date we have to give the format of i/p string. But in some cases, even if i give a format other than the format of i/p string, I am getting the o/p.
    Ex1. SELECT to_date('01.JAN.2008','DD-MON-YYYY') from dual;
    Ex2. SELECT to_date('01/JAN/2008','DD-MON-YYYY') from dual;
    Ex3. SELECT to_date('01-JAN-2008','DD-MM-YYYY') from dual;
    Ex4. SELECT to_date('01-JANUARY-2008','DD-MM-YYYY') from dual;A)The answer for 1 and 2 is, Oracle will not match separators(./-) in the string and format mask.
    It only matches corresponding values. space can be a separators in the format mask.
    Ex:select to_date('2008-01-01','YYYY MM DD')  from dualIn case if the i/p string does not match with the format mask, Oracle substitutes the format mask element with its alternatives and even after this, if it cannot convert the i/p string to the given format mask, then it throws an error.
    Alternate Format masks Table:
    Format Mask Alternate Format Mask
    Element       allowed in i/p String
    MM       MON,MONTH
    MON     MONTH
    MONTH MON
    YY       YYYY
    RR        RRRR
    RR         RRIn Ex3 and Ex4, we have MM in the format mask and MON (JAN), MONTH (JANUARY) in i/p string.
    According to the above table, Oracle makes an implicit substitution of alternate format mask MON or MONTH
    and hence it does not give an error. But this statement SELECT TO_DATE (’01-01-2008’,’DD-MON-YYYY’)
    FROM DUAL will always error out because according to the above given table, if you have ‘MON’ in the format mask, then only MON (JAN) or MONTH (JANUARY) is allowed in the i/p string.
    Q) Since format mask is optional, if i do not give any format mask, then How Oracle will convert the given string to a date?
    A) If we do not specify any format mask, then Oracle assumes that the string is in default date format and tries to convert it into a date.If the i/p string is not in the default date format, then it will give an error.
    Ex: Assume that the default date format is ‘DD-MON-RR’.
    Now if you execute a statement like, SELECT to_date(’01-01-2009’) from dual, it will error out since it is not in the default format and also not convertable by implicit substitution according to the implicit substitution table.
    Q)If i have time fields in the format mask and if i did not give them in the i/p string like select to_date('10-JAN-2008','DD-MON-YYYY HH24:MI:SS') from dual ,will it error out?
    A)You can omit the time fields in the i/p string, beause if nothing is provided then Oracle will implicitly take time as 00:00:00 and hence it will not give an error.
    Q)If i give some thing like select to_date('2008-05-01','DD-MM-YYYY') from dual, it errors out but if i give select to_date('2008-05','DD-MM-YYYY') from dual, then there is no problem. what is the reason for it?
    A)On seeing the format mask DD-MM-YYYY, it takes first 2 digits (20) as DD ,the next 2 digits(08) as month, the next 2 digits for year(05).After coming this far, still there is some portion(01) of the string that is not matched and hence it throws an error and once we remove ‘01’ as given in the question, it works absolutely fine.
    Edited by: Sreekanth Munagala on Feb 25, 2009 3:45 AM

    I think what Boneist is saying, and I agree, is that the answer to the first Q is misleading.
    Sreekanth Munagala wrote:
    Q)Some people have a misconception that a statement like to_date('01-01-2008','DD-MM-YYYY') will always convert the string '01-01-2008' into a date with the given format 'DD-MM-YYYY'.
    A)It might or might not .It all depends on value of NLS_DATE_FORMAT parameter in NLS_DATABASE_PARAMETERS view.Well,if the value of the parameter is 'DD-MM-YYYY'
    then the answer is 'YES' else the answer is 'NO'.The Answer should simply be "It won't". with the reason being that "the DATE datatype does not have a display format, only an internal format which is consistent regardless of how you want to display it. The format specified in the TO_DATE function relates to the format of the input string; how the date returned from that function is _displayed_ is completely independant of, and unrelated to, the TO_DATE function."

  • Does the bluetooth function work with the scanner function on my Photosmart C5550?

    I have a new Dell computer and an HP Photosmart C5550.  I use bluetooth to connect to the print. The printer function works correctly but the computer does not recognize the scanner function. Does the scanner function work with bluetooth?
    This question was solved.
    View Solution.

    Sorry. I hit post before I could elaborate. Not sure what I was thinking. The Bluetooth connection will only support printing. To use the scan feature you will need to connect the printer using a USB or network connection. Hope that explains it a bit better.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • ITunes 10.1 - Shuffle function no longer works correctly

    The shuffle function on playlists no longer works correctly since the most recent iTunes update.
    It will periodically stop playing without playing the entire playlist. It is a real hassle and kills the mood as you have to go back to the Mac and click play again. Please fix this issue as it is a very basic function.

    Thanks for letting us know, however, this is a user to user forum and not an "Apple Run" forum.
    You need to report to Apple via:
    http://www.apple.com/feedback/

  • The to_date function doesn't work ?

    Hello
    I don't know why my to_date function doesn't work on my pc.
    my statement is pretty complex so i just tried simple one
    select to_date('10-Jan-2006','dd-mon-yyyy') from dual;
    but even this one doesn't work it says it is invalid month
    howcome?
    is it because my Windows XP (not english version) doesn't recognise month Jan?
    i tried it another place it worked
    so is there any language pack / patch i need to install? ?
    so does OS matters?
    or how to fix this..please help me

    By default SQL Developer picks up it's language settings up from (on Windows) the Regional and Language Options. You can see what it has set by querying the NLS_SESSION_PARAMETERS view.
    Assuming you don't want to change to using DD-MM-YYYY formats for your months or change your regional settings on your PC, you need to tell SQL Developer which language you want, which you can do by adding the following lines to the file sqldeveloper\jdev\bin\sqldeveloper.conf:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=US

  • Function keys are not working correctly

    I've been looking all over the various threads and I can't find an answer that solves my problem.
    Here are the details:
    I bought the computer in the U.S. where I live.
    I have a iMac 2.4GHz intel Core 2 Duo  EMC 2133 with a 20" screen. Bought it new in February 2008.
    I have Mac OS X 10.5.8  (I am waiting for my order for OS Snow Leopard to come in!!)
    I have been using a wireless mouse and Keyboard (Love not having cords!)
    Recently, my wireless keyboard got a short and quit working. I went down to the apple store and got a new wireless keyboard.
    I had the computer with me at the genius bar so, yes, the apple employee saw exactly what I have.
    I took it all home got the thing all put back together and got the new keyboard paired up and working with the computer.
    Here are the problems:
    Went to go use the function keys while using iTunes and found they weren't working properly. The F10, F11 and F12 do not control the volume of sound as the keyboard indicates they would, they instead activate dashboard, spaces, and application windows. 
    Following the advice of other threads, I looked over in the system preferences and made sure the "Use all F1, F2 etc." box was unchecked (it was unchecked), things still didn't work.
    I tried the fn key but it appears to not work at all it has no effect on the functioning of the function keys.
    I went under keyboard shortcuts in system preferences and found the F10, F11 and F12 keys, it confirms that those keys control spaces, dashboard and application windows as they are performing but shows no options to either reassign to volume control (as marked on the keyboard) or make the fn key work.
    I've gone back and forth trying various combinations of checked and unchecked boxes to see if anything would work, so far I've come up with nothing.
    A couple more important or interesting facts:
    Yes I have turned off and taken the batteries out of the old keyboard. My bluetooth connection currently shows it as disconnected.
    I have restarted the computer.
    One thing I find odd; when I go under preferences and go to Keyboard and Mouse when I go under the section "Bluetooth" it shows Bluetooth mouse with the name of the mouse and the battery level. BUT nothing is showing up under bluetooth Keyboard, I can't figure out how to change this and don't know if it is contributing to the problem.
    When I go under the bluetooth logo on the top bar I find the mouse and both keyboards referenced, the old keyboard is shown as disconnected and the other two are connected. I have tried to update the device's name but it doesn't seem to let me.
    I have double clicked on the device under bluetooth and it shows the new keyboard as discoverable, paired and connected. Hence, I am using the new keyboard to write this inquiry.
    Please, any assistance would be of great help. I have tried to be thorough in order help narrow the possible problem. Thanks!!

    Hendry
    Just thought I'd let you know.  Our suspicions were correct, it was the OS. After I installed Snow Leopard (10.6.8) all the problems were corrected.  I also updated the RAM from 1 gb to 6 gb. The mac is working all around better. Sorry it took so long to get back to everyone. My superdrive had pooped out. Rather than replace it I got an external drive from OWC connected with firewire 800.  So far everything is running very well, as far as I can tell this external drive is better than the original superdrive. My superdrive has always acted funny, infact I returned the first mac I got after a week because its superdrive was also malfunctioning. Anyway, all that to say everything seems to be fully functioning again.
    Roy
    Re: Function keys are not working correctly 

  • I recently downloaded 6.1.2 and am regretting it...for one reason...the search function no longer works correctly. !!

    I personally and professionally rely on text messaging extensively. Since upgrade, the search function doesn't work correctly. It only returns partial results. This has never happened with previous upgrades.  All the old texts are there but it does not search the entire history.  If i compose new text and duplicate the recipients from an old text, it will bring up string...just cant search for it.  PLEASE HELP SOMEONE.

    HarryAustralia wrote:
    I recently updated my ipad wifi only to the new ios 6.1.2 and initially I had the auto cover lock option which can be seen in the Generals tab, but then it stoped working!! Before the update, the auto cover lock worked fine. So after trying all the options, I then did a complete reset on the ipad and now its gone all together from the General tab!! I can no longer see the "auto cover lock" option.
    The iPad cover lock is for when you use a cover with magnets in it to lock and unlock the iPad when you close the cover or open it. Try running a refrigerator magnet along the sides of the iPad and see if that trips the iPad Cover Lock back into the settings.
    That is not the same thing as the iPad Auto Lock setting which allows you to set an allotted time before the iPad goes to sleep.
    You can try resetting all settings to see if the Auto Lock feature retinrs to the iPad.
    Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. This can be a little time consuming re-entering all of the device settings again.

  • HT4773 I have upgraded to Lion and I have a new Apple keyboard, however none of my function keys work correctly. Any idea what is the solution?

    I have upgraded to Lion and have a new keyboard. The problem I have is that the function keys are not working correctly - none of them. F1 -> F6 are not working at all and F7 - F12  do what F1 etc are supposed to do. Any ideas for a solution?
    Thanks in advance

    That message is telling you to update iTunes on your computer, not your phone. You need iTunes 11.1 on your computer in order to sync your devices.

  • Read XML function - can't get it to work correctly to set metadata

    I've been working with the Read XML function in order to set metadata on assets with no avail. I'm using the following simple XML file in a Watcher folder with a poll watcher setup every 5 seconds, that then references a Read XML Response named "Update Asset Metadata" - to read the XML file and update the asset metadata. Nothing really happens even though the FCS Log file shows that the process is taking place to "update" the asset metadata. Any advice is appreciated. Thanks!
    FILE:
    <?xml version="1.0" encoding="UTF-8"?>
    <FinalCutServer>
    <request reqId="setMd" entityId="/asset/10">
    <params>
    <mdValue fieldName="Title" dataType="string">Text Info Change</mdValue>
    </params>
    </request>
    </FinalCutServer>

    I got the answer. You must type “*.xml” (that is, asterisk-dot-xml) in the Value field of Wildcard Include Filter for it to work correctly.

  • I have a manual that contains headings and index entries that contain less than and greater than characters, and . The Publish to Responsive HTML5 function escapes these correctly in the main body of the text but does not work correctly in either the C

    I have a manual that contains headings and index entries that contain less than and greater than characters, < and >. The Publish to Responsive HTML5 function escapes these correctly in the main body of the text but does not work correctly in either the Contents or the Index of the generated HTML. In the Contents the words are completely missing and in the index entries the '\' characters that are required in the markers remain in the entry but the leading less than symbol and the first character of the word is deleted; hence what should appear as <dataseries> appears as \ataseries\>. I believe this is a FMv12 bug. Has anyone else experienced this? Is the FM team aware and working on a fix. Any suggestions for a workaround?

    The Index issue is more complicated since in order to get the < and > into the index requires the entry itself to be escaped. So, in order to index '<x2settings>' you have to key '\<x2settings\>'. Looking at the generated index entry in the .js file we see '<key name=\"\\2settings\\&gt;\">. This is a bit of a mess and produces an index entry of '\2settings\>'. This ought to be '<key name=\"&amp;lt;x2settings&amp;gt;\" >'. I have tested this fix and it works - but the worst of it is that the first character of the index entry has been stripped out. Consequently I cannot fix this with a few global changes - and I have a lot of index entries of this type. I'm looking forward to a response to this since I cannot publish this document in its current state.  

  • HT2216 I am on OSX 10.7.5 and recently had to reinstall it due to 'mail' not working correctly.  That problem was resolved but now my I can't use the 'right click' function on the apple usb mouse.  Any clues?

    I am on OSX 10.7.5 and recently had to reinstall it due to 'mail' not working correctly.  That problem was resolved but now my I can't use the 'right click' function on the apple usb mouse.  I only have a previous version re-install disc as I bought the latest OSX off the app store.  Any help gratefully received?

    Hmmm, no, no drivers needed, now it sounds like a bad install... unless you might have some old Mouse software installed???
    If 10.7.0 or later...
    Bootup holding CMD+r, or the Option/alt key to boot from the Restore partition & use Disk Utility from there to Repair the Disk, then Repair Permissions.
    If that doesn't help Reinstall the OS.

  • What can I do if my function keys don't work correctly?

    QuestionWhat can I do if my function keys don't work correctly?
    AnswerFunction keys can mean a few different things. You might be having a problem with the F-keys near the top of your keyboard (F1, F2, etc.), the secondary functions of the F-keys (toggling the wireless or touchpad, for example), or special media keys on your laptop.
    There are a few steps you can take to try to resolve these issues. Try the suggestions listed below in the order presented. If a step fixes the problem, you're done! If a step doesn't fix your problem, continue to the next step.
    Understand the FN key
    First, ensure you understand how to use the FN key. In most newer models, the special utilities of the F-keys are used when you press the F-keys. To use the F-keys, you need to hold FN first. In older models, this was reversed. pressing the F-keys activated the F-keys. The special utilities of the F-keys are used while holding FN. If you're having trouble using your F-keys, try both with and without the FN key.
    Reinstall TVAP or Toshiba Flash Cards Utility
    Some models may use the Toshiba Value Added Package or the Toshiba Flash Cards Utility. Check the support site to see if these utilities are available for your model. If you see either listed, download and install it. Some models don't use these utilities; it's okay if you don't see either of them.
    How To: Identifying and locating the correct driver for your device
    Perform a power cycle
    Perform a power cycle on your laptop.
    How To: Proper Power Cycle Procedure for Laptops
    Perform a System Restore
    Restore your computer to a previous point when the keys were working correctly.
    How To: Understanding System Restore, Refresh, Reset, and, Recovery options in Windows 8 + Video
    How To: Perform a system restore in Windows 7
    Perform a System Reset
    If the previous suggestions don't help, you may want to try a System Reset (also known as a System Recovery). This returns the laptop to factory default conditions. Note that this means any data or application you added will be gone.
    How To: Understanding System Restore, Refresh, Reset, and, Recovery options in Windows 8 + Video
    How To: Perform system recovery - Windows 7
    Seek servicing
    If the System Reset didn't fix the problem, your computer could require servicing. Please call customer support.

    Contact Apple Support to get it serviced or visit an Apple Store or Authorized Apple Service Provider next to your place.
    iPhone - Contact Support - Apple Support

  • Numbers application on Ipad, the 'VALUE' function doesn't seem to work correctly on the string/text I want to convert to a value.

    Hi, I would appreciate if someone could assist with the following.  On the Numbers application on my Ipad, the 'VALUE' function doesn't seem to work correctly on the string/text which I want to convert to a value.  It gives me an error (in my example: 'VALUE requires a string specifying a number, but found "-14308.65" instead.'
    The exact same document (if converted from Numbers to excel), displays the converted string/text correctly in MS Excel as a value though.

    click on the cell then in the formula bar and use the arrow keys to move the cursor to see if there are any other characters in the cell that could confuse the function.  Also make sure the localization for your country is correct in System Prefs.
    Maybe copy the EXACT contents of the cell and post here.

Maybe you are looking for

  • Not able to access the context in custom functoid

    Hi, Below is the code referred from https://contextaccessor.codeplex.com/, Implemented this Custom Pipeline  component in the Resolve Part stage: The below code under Class = AccessContext [ThreadStatic] internal static IBaseMessageContext  context;

  • Macbook Pro won't detect internal drive.

    So Last night my macbook pro fell off a desk about 2 feet high. At the time I was running Iweb on it. I thought everything was okay but after about 15 minutes it bagan acting slow. When I would click something it would take about 5 seconds for the co

  • ABA No field in House bank

    Hi Iam a sales consultant , i got a requirement to add ABA no for one of the house bank , There is no field in FI12 to capture this information. How can we maintain ABA no for a House bank? Thanks, Vaishnavi

  • Over-Delivery in Goods Receipt

    Hi all, I'm setting an over-delivery limit of 10% for all Goods Receipt with respect to a Purchase Order. But for over-deliveries above 10%, i want a superior officer to approve the receipt. Is it possible to have this type of setting in SAP? If so,

  • Adding mutiple disks to solaris 8

    I have 3 unsed disks on my SUN and want to combine them into one mount point. Is it possible to select all 3 when I "format" them. Thanks in advance.