ORA-01843: not a valid month

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deep2389
    New Member
    • Sep 2007
    • 3

    ORA-01843: not a valid month

    Hi,
    I need to run a stored procedure which accepts date as an input. If I input date say 11252000 (MMDDYYYY), it is accepting but for dates such as 03062000, it is throwing error "ORA-01843: not a valid month". Please help me out. In the procedure, I am using to_date to convert the date into MMDDYYYY format, but its not working for all cases. Also if someone gives a date such as 0622000 (June 2nd 2000) or 5112000 (May 11th 2000), how to handle these? Any helping hand would be appreciated.



    Thanks,
    deep
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to convert the date to particular format before processing.

    Comment

    • deep2389
      New Member
      • Sep 2007
      • 3

      #3
      Originally posted by debasisdas
      You need to convert the date to particular format before processing.
      Can I decode the date based on its length...

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by deep2389
        Hi,
        I need to run a stored procedure which accepts date as an input. If I input date say 11252000 (MMDDYYYY), it is accepting but for dates such as 03062000, it is throwing error "ORA-01843: not a valid month". Please help me out. In the procedure, I am using to_date to convert the date into MMDDYYYY format, but its not working for all cases. Also if someone gives a date such as 0622000 (June 2nd 2000) or 5112000 (May 11th 2000), how to handle these? Any helping hand would be appreciated.



        Thanks,
        deep
        Let me answer your second question first:


        >>Also if someone gives a date such as 0622000 (June 2nd 2000) or 5112000 (May 11th 2000), how to handle these?

        What you can do is, when the input value is passed to a procedure, then check it length, if the length is less than 8 then raise an application error "Invalid date entered. please enter in format MMDDYYYY"

        For your first question, I would be interested to have a look at your source code(procedure) for better understanding. Could you please post your source code here?

        Comment

        • subashsavji
          New Member
          • Jan 2008
          • 93

          #5
          Originally posted by deep2389
          Hi,
          I need to run a stored procedure which accepts date as an input. If I input date say 11252000 (MMDDYYYY), it is accepting but for dates such as 03062000, it is throwing error "ORA-01843: not a valid month". Please help me out. In the procedure, I am using to_date to convert the date into MMDDYYYY format, but its not working for all cases. Also if someone gives a date such as 0622000 (June 2nd 2000) or 5112000 (May 11th 2000), how to handle these? Any helping hand would be appreciated.



          Thanks,
          deep
          may be this helpful to

          better you declare that date item as varchar2 while displaying convert it using To_char
          function.

          Comment

          Working...