Why not months_between works for me?

Select *.

of hr.employees

where months_between(hire_date,01-Jan-2000) > 100;

A simple query that check for the duration of the employees of more than 100 months of months but this gives me the error ORA-00904.

hire_date is a date column.

HR.employees / / DESC

Name of Type Null

-------------- -------- ------------

EMPLOYEE_ID NOT NULL NUMBER (6)

FIRST NAME VARCHAR2 (20)

LAST_NAME NOT NULL VARCHAR2 (25)

EMAIL NOT NULL VARCHAR2 (25)

PHONE_NUMBER VARCHAR2 (20)

HIRE_DATE NOT NULL DATE

JOB_ID NOT NULL VARCHAR2 (10)

SALARY NUMBER (8.2)

COMMISSION_PCT NUMBER (2.2)

MANAGER_ID NUMBER (6)

DEPARTMENT_ID NUMBER 4

Hello

"...where months_between(hire_date,01-Jan-2000) > 100;...". "hire_date is a date column."

And what about the January 1, 2000? It is not the case. And if the example with 1 January 2000 ' is not to work, to think: is January 1, 2000 "a date or another? No it's not.

If you put a string where Oracle waits for a date or a string where Oracle expects a number or a number where a string is expected, and so on, force you Oracle to do an implicit conversion (so-called implicit conversion). It's something that you should avoid. Remember that you should NOT have things like 'WHERE a_number = a_string' or 'WHERE a_string = a_date'... Always compare apples and apples or pears and Pears: decide yourself if you need 'WHERE TO_CHAR (a_number) = a_string' or 'a_number = TO_NUMBER (a_string)' or 'TO_DATE (a_string) = a_date' or 'a_string = TO_CHAR (a_date) '... Next step is to offer a FORMULA: do not depend on the default format (default format may change from one session to another...). Example: what is TO_CHAR (a_date)? Maybe he'll use "DD-MON-YYYY", but perhaps "MM/DD/YY HH24", or "YYYYMMDD HH24:MI:SS", or...)

So: for your original question: you can for example use WHERE MONTHS_BETWEEN (employees.hire_date, DATE ' 2000-01-01') > 100

(but BTW for this query, it is preferable to use something like employees.hire_date WHERE)< add_months(="" date="" '2000-01-01',="" -100="" )="">

HTH,

Bruno Vroman.

Tags: Database

Similar Questions

  • Why Apple ID work for the devices iOS and Yosemite... .but not for iCloud?

    Recently, I upgraded to Yosemite. So I was forced to change my PWD for Apple ID.  I have AN AppleID account. After having changed the PWD, other requested change upgrade iOS devices, and all the work.

    UNLESS iCloud refuses to accept my new Apple ID... All other devices, updates work fine with the new PWD AppleID...

    What is the problem with iCloud?

    How can I force it to accept the Apple that accept all other devices/systems ID?

    Jim B

    Have you tried the signature to iCloud and then again?

    What to do after changing Apple ID or password - email address

  • Why not remember passwords for sites to work?

    I just bought a new HP Envy 8.1 Windows running. I can't get passwords to remember the sites to work. The pop up shows and correct settings have been selected in tools, but nothing will save. I guess I'm on the latest version of Firefox since I downloaded on my computer today. My old computer that is also running windows 8.1 worked fine with passwords do not forget.

    Ok. Thamks. I'll mark this thread solved. I have a copy of the original and renamed files, so if I lose the info of password management, I'll have to back ups. Once again thank you.

  • Why not the fix for update my Acrobat 10.1.11 at 10.1.12 work? -He repeats to me there is a problem and make back to 10.1.11

    I use Windows 7 Professional. I have been informed that I need to update my Acrobat 10.1.11 at 10.1.12 but everytime I try it tells me that there is a problem and I need to contact my service provider patch! My patch provider is Adobe, but there is no way to ask them for help. What should I do? That I have to completely remove Adobe Acrobat 10.1.11, then re-intsaller of the DVD and then try again or should I just let my existing 10.1.11 version which works fine?

    Hi del Rio. Thanks for your help. With assistance from the repair shop didn't work, so I installed the program, then re-installed from my DVD, then upgrade to 10.0.0 10.1.12 and everything is fine.

  • My password is not now working for my WN1000RP and each tip failed (2nd request)

    I tried to reset the modem, I tried the genius of NETGear on my IPAD, I tried to turn off the Extender, I tried to connect through the INternet... nothing worked. Do my usual password or admin/password by default.

    What I did was to go to a WIFI Hotspot. When I came back, instead of going to the _EXT # automatically, he now asks me my password it will not now. He has never done this before.

    I use an IPAD 2 with IOS 9. I have upgraded to IOS 9 when it first came out, so I don't think that's the problem.

    Thanks for any help.

    Lee

    Thank you

    The one who FINALLY worked (thank God) is that I have reset back my settings by default, and then started over. (I don't even have to try deleting the network profile)

    Everything worked fine now.

    Must have been that d * n IOS 9 update.

  • Why not buy games for my PC such as the birds angry and considering that water?

    The above and other games are not available for the PC.  Why is this?  Also is there a form any lemming there for PC?

    Hi Sandra!

    Please see here: http://download.angrybirds.com/ and here: http://www.classic-retro-games.com/Lemmings_384.html

    Just search the internet a bit!

    Hope this is useful.

    See you soon
    Julia

  • Why not sharing work this morning?

    I can create a public link but when I click it.  I get a message that says that the link is not active.

    @Vida A - are you using to send the link for individual files or a folder containing files?

    I found that if I create a link to a file and immediately, click on the link that I sometimes "Sorry, this link is no longer active." If I close the public link page, wait 5 seconds or two, and then reopen the link it works.

  • Why not sierra update for mp 2010?

    Hi all

    I have a mac pro mid-2010 / 5.1 with 10.11.6. Today, I had to look the system updates. There were shown raw update 6.21, affinity 1.4.3 and safari 10.

    But no sierra updates.

    Mac pro 2010 is listed as a sierra took in charge the machine.

    What should I do? Wait one or two days (due to a deployment of round-robin mechanism), or I will ask for an update downloadable combo?

    Greetings from the Germany

    Chris

    Ta-daaa, found.

    It is not updated in monthly basis, I have to "buy / charge" of the appstore.

  • Why not download work touches again creative cloud account?

    I started a new creative cloud account but the download button does not have to download any application.  I would like a trial version of InDesign, but nothing moved after I click on download.  Also could not install the creative cloud App for easy management.  Thank you.

    Steve, it seems that your browser may have fallen to the file extension, what happens sometimes (especially with IE)...

    Rename to add a ".exe" at the end of the file name on Windows, or ".dmg" on Mac, and you should be good.

  • Why not speedial work after I downloaded it?

    Some how I lost my CD original speedial and lost all it's happy. I tried to download the addon speedial twice, he said he would start automatically after restart of firefox. He never shows. I have also several toolbars showing that I know not whence they came, even if I've deleted from my hard drive, they are still in my opinion of toolbar. It is constantly in my windows newly opened as a search page, mixdj V31 of Bing, and I don't know how to get rid of it. What a mess, don't know what happened that changed everything.

    I think that MixiDJ is an extension. You can view and disable all extensions essential or unknown here:

    Firefox orange (or the Tools menu) button > addons > Extensions category

    Usually, there will be a link to restart Firefox to complete the process of deactivation or removal, so go ahead and click on one, if you see here.

    On this same tab, you see the dial extension you have installed? Note that extensions disabled clustered toward the bottom of the list, and you might find it there.

  • Why not * true * customization for the Cookies of Firefox?

    Of course, there are cookie options. But I want to be able to individually allow ONLY some cookies while refusing others when I get out of Firefox. In its current form, it seems you can check only one that allows or deletes cookies when leaving. I use iGoogle as my home page and cookies must be enabled permanently in order to maintain its settings. Of course, this means that unwanted cookies are also allowed to stay. I need * true customization.

    Hi guys:

    Thanks loads for your helpful suggestions. If all goes well, the Mozilla group will be much easier management of cookies (perhaps a characteristic click) in the future.

    Thanks again.

  • Windows Mail can receive mail but not send worked for years

    I used Messaging windows for many years and now all of a sudden I have that can receive messages but can't send it I tried everything that the help section nothing. Does anyone have an answer or a suggestion?   Help, please

    I don't know your password.  If you have forgotten your password, you need to ask your ISP.  The concept behind a password is that only you know.

    Steve

  • Why not chat work?

    Why no one answered questions in the chat, and I find myself here instead?

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...
    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Creative cloud support (all creative cloud customer service problems)
    http://helpx.Adobe.com/x-productkb/global/service-CCM.html ( http://adobe.ly/19llvMN )

  • CC for lr wants to use my move my catalog lr5.  This is just a test of cc, I don't want to disable my lr5 cc may not even work for me.  pls explain if this will change my lr5

    pls advise if I move the catalog, a gesture or a copy?  My lr 5 will be still functional.

    For confirmation purposes, it is better you take the backup of catalogs.

  • Selection tool works not - only work for moving objects

    My selection tool does not at all - when I select an object with it, it only shows the anchors of direct selection, but does not allow me to change an anchor elements. It will allow me to move the object to resize (or change the position of the anchorages either).

    When I select the text tool and press command to change the text box, nothing happens and it won't let me change anything.

    I'm in CS5, on a Mac.

    I already rebooted Illustrator (nothing is) and then restarted my computer, and it is not yet fixed.

    Help?

    Take a look at show/hide edges and show/hide the rectangle enclosing. Both located in the view menu.

Maybe you are looking for